Is it possible to enable Pulse Counter (PCNT) and gpio interrupt on the same pin?
Is it possible to enable Pulse Counter (PCNT) and gpio interrupt on the same pin?
Hi, I am implementing a pulse counter for an encoder. I would also like to capture the edge in ISR and perform some action. However, when both PCNT and interrupt using `gpio_isr_handler_add`, the interrupt handler no longer gets called. I assume this was because the signal was routed to PCNT peripheral. Is it possible to enable both gpio isr and PCNT on the same pin?
-
- Posts: 9772
- Joined: Thu Nov 26, 2015 4:08 am
Re: Is it possible to enable Pulse Counter (PCNT) and gpio interrupt on the same pin?
Should be possible. In what order are you setting up the interrupt and the pulse counter? Can you swap that around?
Re: Is it possible to enable Pulse Counter (PCNT) and gpio interrupt on the same pin?
I have tried gpio_config > gpio_add_handler > pcnt setup as well as gpio_config > pcnt setup > gpio_add_handler. In either case,only pcnt works. the interrupt handler won't be called. Without pcnt the interrupt worked
Re: Is it possible to enable Pulse Counter (PCNT) and gpio interrupt on the same pin?
Welp, I could confirm that the correct combination to make PCNT and gpio interrupt work simultaneously is: PCNT setup -> gpio config -> gpio interrupt handler
Who is online
Users browsing this forum: No registered users and 113 guests