Closed adamreisnz closed 6 years ago
After some further analysis, I've managed to create a test script that reproduces the issue. However, the problem is that it doesn't reproduce it consistently.
const rpio = require('rpio');
const {INPUT, OUTPUT, HIGH, LOW, PULL_UP} = rpio;
const pin = 29;
console.log('Opening pin');
rpio.open(pin, INPUT, PULL_UP);
console.log('Pin opened');
console.log('Setting up polling');
rpio.poll(pin, pin => {
console.log('In poll cycle');
console.log('Reading state');
const state = rpio.read(pin) || LOW
console.log(`Pin state is ${state}`);
});
As soon as it hits the line with rpio.poll
it crashes. The last console output is Setting up polling
.
I've also tried with different pin numbers, and with calling the poll function after a timeout, all to no avail.
After running a few more tests, it appears the culprit is the pull up statement. After removing this, the device no longer seems to crash when reading/polling pin input.
It appears this issue is related https://github.com/raspberrypi/linux/issues/2550
I've been battling lockups for the past couple of months. I think it's the same issue you've reported - it started happening after a kernel update (sorry - I didn't record the kernel version). This code consistently (but not always) causes a crash:
var rpio = require('rpio');
var led = 17;
var btn = 2;
rpio.init({mapping: 'gpio'});
rpio.open(btn, rpio.INPUT, rpio.PULL_UP);
rpio.open(led, rpio.OUTPUT, rpio.HIGH);
rpio.poll(btn, pollcb);
function pollcb(pin)
{
var state = rpio.read(pin) ? 'released' : 'pressed' ;
rpio.write(led,rpio.read(pin));
}
I've tested this on 3B and 3B+ hardware with the same result.
I noticed a few things:
Until your post today I wasn't aware that anyone else was having this problem, but it's a huge issue for me.
Andrew.
Yep, sounds like the same thing with the same symptoms, in particular number 2.
I'm creating a new image now as we speak using an older kernel version (4.9, from http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-03-14/) and once I have that up and running I will report back.
Great. Let me know if you need me to test anything.
I can confirm that everything works as expected on 4.9. So the culprit was definitely the linked issue with the 4.14 kernel. Will close this one.
same problem, my script:
const rpio = require('rpio');
const pin = 11;
rpio.open(pin, rpio.INPUT);
rpio.poll(pin, (pin) => {
console.log('Button event on pin %d, is now %d', pin, rpio.read(pin));
});
My kernel is 4.14.34-v7+.
By the way, this python script works well:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
channel = 11
GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
cur = False
while True:
tmp = GPIO.input(channel)
if tmp == cur:
time.sleep(0.05)
else:
print tmp
cur = tmp
Did you check https://github.com/raspberrypi/linux/issues/2550?
It still hangs with the recent (4.19.x) kernel. Any idea what causes it? So I can submit a ticket to raspbian developers. The latest working version is 4.9.80 (can install it with: sudo rpi-update 5c80565c5c0c7f820258c792a98b56f22db2dd03
- just as a note).
Did you enable dtoverlay=gpio-no-irq
?
Can confirm that dtoverlay=gpio-no-irq
solves the hangups with recent kernels, thanks a lot!
Have you had any other reports of this? Everything used to work fine until recently, but now whenever I try to connect to an input pin, the Raspberry Pi outright crashes/freezes and I have to manually reboot it.
This is with rpio version 0.9.22, tested with Node 8.9.4, 8.10.0 as well as 8.11.3. Installed on a fresh install of Stretch lite, the last image of April 2018. Full apt-get upgrade.
Any idea's what could be happening? Any underlying packages that may have been updated and are causing failures with rpio?