Power & Source of Big Ideas

RPi.GPIO event detection not working on NEO

Moderators: chensy, FATechsupport

Hello :),

I'm trying to get the GPIO event detection working using a NanoPi NEO board and python.
I've tried something similiar to this:

Code: Select all

import RPi.GPIO as GPIO

pin = 7
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)

GPIO.wait_for_edge(pin, GPIO.FALLING)
print('change detected')


Problem is: a flank change is never detected. I can read/write the GPIO's with no problems, but if I use wait_for_edge or add_event_detect a changed GPIO is never reported back.

This problem exists on both latest 4.11.2 roms (jessie and xenial).

I'd appreciate any help on fixing that problem.
This is an old problem, but if I'm wrong, please let me know. The implementation from FriendlyArm team is partial. This has been discussed in this forum a long time ago, please read viewtopic.php?f=47&t=872

About RPi.GPIO_NP, I did a release (not based on the official one) that fixes these known issues at https://github.com/auto3000/RPi.GPIO_NP. This release could be built for the desired python2/3 installation. Personally I'm using a custom distribution (yocto-based) on kernel 4.11 and python 3, but I've heard that it was working on a kernel 3.14 and python 2.
Thanks for the reply, auto3000.

I was away with my family over christmas so it took me awhile to try that out.

Unfortunately I've run into some problems with your port. As per your installation instruction I've first tried to install the RPi.GPIO package via apt-get, but that package isn't contained in the xenial repository.

Next step was to setup the python dev sources and recompile/setup your code, which worked fine. But whenever I try to wait for an edge or add edge detection in python I either get "Error waiting for edge" or "Failed to add edge detection" errors.
I've traced this back to the blocking_wait_for_edge call in py_gpio.c:py_wait_for_edge which returns -2.

Any more tips on what the cause for this problem might be?
Nice to see your progresses.

Hum I'm unable to suspect the root cause, I just reviewed in the code of "blocking_wait_for_edge" code, there are a lot of possible issues that returns -2. I would first try a strace investigation. Ultimately, I would add logs in the code of blocking_wait_for_edge code for each "return -2".

Actually, RPi.GPIO_NP works for my limited usage. But generally speaking, original code of RPi.GPIO (the original one for raspberry pi) lacks of logging, this would be useful to enhance that. There are a couple of warnings too during the build. If someone provides any modification (someone already did this in the past), I would integrate these.

Who is online

In total there are 8 users online :: 0 registered, 0 hidden and 8 guests (based on users active over the past 5 minutes)
Most users ever online was 825 on Wed Aug 28, 2019 3:18 pm

Users browsing this forum: No registered users and 8 guests