I cut/paste a related information exchange I had w/ Kent from the gpiod mailing list. The arbian-monitor output is in the attached file.
>>>>>>>>
I wired a GPIO Pin to GND. Upon the cmd: sudo gpiomon -r -n1 -Bpull-up <chip> <offset> the program exits immediately with 1 event, although there was never a rising edge due to the fix wire to GND. Is this a feature or a bug, and is it reproducible?
<
Not a feature and not reproducible for me on a Raspberry Pi4 with the setup you describe, so probably a bug specific to your hardware platform, whatever that may be. If it is 100% reproduceable for you, and assuming it is an initialisation issue so you only get the one spurious event, how about using -n2 as a workaround ? Cheers, Kent.
>
It appears 2b reproduceable 100% on my OrangePi zero+ (Allwinner H5) and using -n2 does the trick, but isn't gpiod not supposed to work on all commercial HW platforms and related kernels, rather then only on RPI??
<
gpiod will work on any platform with a supporting kernel. How well depends on the underlying hardware and driver. The RPi4 was merely a counter-example demonstrating that your issue is not universal, using hardware I happen to have readily available. Cheers, Kent.
>
So if I understand you right, gpiod works on sort of a logical level, while the HW dependend part depends of the kernel driver implementation of the specific HW?
<
libgpiod is a userspace library and tools to access GPIO lines via the Linux GPIO character device. The actual interfacing to the hardware is performed by the kernel and appropriate drivers for your hardware. As your problem does not exhibit on other hardware, the root cause of your problem probably lies in the driver for your hardware, not in libgpiod nor the gpiolib subsystem of the kernel. But you would need to debug it further to be sure. Cheers, Kent.
* Event should be more correct than Interrupt.
I made some trial to understand if it is reproduceable, but I have difficulties defining, when it happens. After RESET there is no spurious event. The spurious event appears to happen, when the line was moved:
RESET, gpiomon -r -n1 -Bpull-up 1 6 => No event, -> pull line up /down, => event (as expected), gpiomon -r -n1 -Bpull-up 1 6 => false event
There might be an issue w/ pending interrupts, when the line is bouncing when pulled up/down. The 2nd gpiodmon cmd might catch one of the pending interrupts. (Just an idea). This would hint to an initialisation problem, that pending line states are not preempted, before the int is attached.
If I just let the line go up (by pull-up) and leave it "1", I get continuous false events on every gpiomon... cmd, just like "level interrupts"
Kent Gibson and I performed checks independently on our RPIs and we both can confirm that the problem does no occur on the RPI: Linux raspberrypi 5.10.63-v7+ #1459 SMP Wed Oct 6 16:41:10 BST 2021 armv7l GNU/Linux
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Hans Kurscheidt
I cut/paste a related information exchange I had w/ Kent from the gpiod mailing list. The arbian-monitor output is in the attached file.
>>>>>>>>
I wired a GPIO Pin to GND. Upon the cmd: sudo gpiomon -r -n1 -Bpull-up <chip> <offset> the program exits immediately with 1 event, although there was never a rising edge due to the fix wire to GND. Is this a feature or a bug, and is it reproducible?
<
Not a feature and not reproducible for me on a Raspberry Pi4 with the setup you describe, so probably a bug specific to your hardware platform, whatever that may be. If it is 100% reproduceable for you, and assuming it is an initialisation issue so you only get the one spurious event, how about using -n2 as a workaround ? Cheers, Kent.
>
It appears 2b reproduceable 100% on my OrangePi zero+ (Allwinner H5) and using -n2 does the trick, but isn't gpiod not supposed to work on all commercial HW platforms and related kernels, rather then only on RPI??
<
gpiod will work on any platform with a supporting kernel. How well depends on the underlying hardware and driver. The RPi4 was merely a counter-example demonstrating that your issue is not universal, using hardware I happen to have readily available. Cheers, Kent.
>
So if I understand you right, gpiod works on sort of a logical level, while the HW dependend part depends of the kernel driver implementation of the specific HW?
<
libgpiod is a userspace library and tools to access GPIO lines via the Linux GPIO character device. The actual interfacing to the hardware is performed by the kernel and appropriate drivers for your hardware. As your problem does not exhibit on other hardware, the root cause of your problem probably lies in the driver for your hardware, not in libgpiod nor the gpiolib subsystem of the kernel. But you would need to debug it further to be sure. Cheers, Kent.
* Event should be more correct than Interrupt.
I made some trial to understand if it is reproduceable, but I have difficulties defining, when it happens. After RESET there is no spurious event. The spurious event appears to happen, when the line was moved:
RESET, gpiomon -r -n1 -Bpull-up 1 6 => No event, -> pull line up /down, => event (as expected), gpiomon -r -n1 -Bpull-up 1 6 => false event
There might be an issue w/ pending interrupts, when the line is bouncing when pulled up/down. The 2nd gpiodmon cmd might catch one of the pending interrupts. (Just an idea). This would hint to an initialisation problem, that pending line states are not preempted, before the int is attached.
If I just let the line go up (by pull-up) and leave it "1", I get continuous false events on every gpiomon... cmd, just like "level interrupts"
Kent Gibson and I performed checks independently on our RPIs and we both can confirm that the problem does no occur on the RPI: Linux raspberrypi 5.10.63-v7+ #1459 SMP Wed Oct 6 16:41:10 BST 2021 armv7l GNU/Linux
armbian-monitor-U.txt
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.