React to GPIO fast: ISR or queue?

pastaclub
Posts: 2
Joined: Mon Mar 30, 2020 5:28 pm

React to GPIO fast: ISR or queue?

Postby pastaclub » Tue Dec 26, 2023 2:51 pm

I need to detect a falling edge on a GPIO input, then change the same GPIO into an output and drive it high. This needs to happen within 0.1ms.

How can I ensure a fast reaction time? Most interrupt examples use a queue, but I am worried that this will introduce too much latency. Is there any problem with doing all of this in the ISR? Or do I have to use a queue?

rsimpsonbusa
Posts: 126
Joined: Tue May 17, 2016 8:12 pm

Re: React to GPIO fast: ISR or queue?

Postby rsimpsonbusa » Thu Dec 28, 2023 2:36 am

I suggest having a setup routine that sets the gpio as input and adds it as isr int. Call it from within the ISR after setting it for output. I presume you are not making a delay within, just gpio_ser_level(pin,1) and then gpio_set_level(pin,0) basically a pulse.

Who is online

Users browsing this forum: aapee-jcv and 435 guests