Page 1 of 1

pigpio--scheduling a future interrupt

Posted: Tue Nov 20, 2018 10:35 pm
by davethomaspilot
I see how to use gpioSetISRFuncEx in the pigpio C interface library. I think I can use this along with a gpio "wave" to get an ISR to execute at a precise, future time.

I'm wondering if there's a way to do this without requiring a GPIO to toggle, or does use of the dma hardware/time stamping dictate GPIO usage?

Re: pigpio--scheduling a future interrupt

Posted: Wed Nov 21, 2018 3:26 pm
by RattusRattus
I may have compleatly missunderstood your question.

I am interpreting it as this:
"Is there a way to get an interrupt to happen at a given time without using GPIO lines?"

*IF* that is what you are asking then take a look at "signal ( SIGALRM, <handler>);" in <signal.h>


Re: pigpio--scheduling a future interrupt

Posted: Wed Nov 21, 2018 5:00 pm
by davethomaspilot
sigalarm has 1 second granularity. I need something in the millisecond or better range.

The nice thing about the pigpio implmentation is that (I think) it uses hardware to do PWM on a GPIO. I think that means once started, a pulse on the GPIO will not be pre-empted by anything done in the kernel.

The ISR associated with the GPIO transition might be delayed--but in what I'm seeing, the ISR ALWAYS runs much closer to the scheduled time than what I can achieve with a 1 millisecond poll loop.

So, while I think I can do what I need with a pigpio wave and ISR, I thought there might be a way to do something similar to what's done in the library code without requiring an GPIO to be toggled. But, maybe that's the only way the PWM hardware can be exploited.