I have a very simple requirement. I need to get a precise time between two separate GPIO inputs. Using interrupts seems to be the best way to get the most accurate time without wasteful busy waiting (perhaps that is wrong?). I have spent hours trying to get it working, but keep hitting dead ends. Can you (@6by9) or someone at Raspberry Pi Ltd. provide a basic example of how this is supposed to be done now (i.e. set up a GPIO ISR in C)?
Here is the current chaos developers are facing:
Raspberry Pi is supposed to be for hobbyists, not kernel engineers. Having to spend hours, if not days, learning device tree syntax to divine the correct incantation is ridiculous. Why isn't there a simple, well documented (and fast/efficient) way of doing something as common as having an ISR function called on a GPIO pin change. This should be easy! GPIO is one of the most important features on the Pi, but now it is has become a disappointing mine field of deprecation, obsolescence, and complexity. Raspberry Pi Ltd. really needs to step in here and fix this mess.
In my case, the time between pin changes is in microseconds, so I'd prefer to avoid going through layers of different libraries (libgpiod, wiringpi), if possible. Maybe even posting working dts overlay code would help. Or is there an existing overlay that I can use to enable interrupts on specific pins. If not, then maybe there should be so all I need to do is to add a few lines to config.txt. Let's try to get to 50% less rats nest.
Here is the current chaos developers are facing:
- Some posts suggest using WiringPi. Others state that WiringPI is deprecated. Conflicting post say that it is updated now but doesn't work with Pi5. Do interrupt functions really work (example is from 2013)? Who knows?
- AI states using pigpio and provides an example, which doesn't work of course, because gpio_to_irq is broken (-EINVAL) due to changes in 6.6. Is pigpio deprecated too?
- Using gpiosetAlertFunc as an alternative to a real ISR was not accurate or reliable enough.
- Then we have this post, which now mentions device trees, devm_gpiod_get(), and kernel modules, which opens a whole rats nest of pain.
Raspberry Pi is supposed to be for hobbyists, not kernel engineers. Having to spend hours, if not days, learning device tree syntax to divine the correct incantation is ridiculous. Why isn't there a simple, well documented (and fast/efficient) way of doing something as common as having an ISR function called on a GPIO pin change. This should be easy! GPIO is one of the most important features on the Pi, but now it is has become a disappointing mine field of deprecation, obsolescence, and complexity. Raspberry Pi Ltd. really needs to step in here and fix this mess.
In my case, the time between pin changes is in microseconds, so I'd prefer to avoid going through layers of different libraries (libgpiod, wiringpi), if possible. Maybe even posting working dts overlay code would help. Or is there an existing overlay that I can use to enable interrupts on specific pins. If not, then maybe there should be so all I need to do is to add a few lines to config.txt. Let's try to get to 50% less rats nest.
Statistics: Posted by displaywave — Tue Dec 17, 2024 4:11 pm