Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

ESP-32: Getting current time from inside an ISR

We need to field a bit stream from existing (blackbox) hardware; idle is input high, the input bits are 300uS long, zeros are 150uS input high followed by 150uS input low, ones are 150uS low followed by 150uS high. The data comes in 64 bit packets. The data packets starts with 15 one bits to provide sync.

We are using an ESP-32.

It's been suggested to stay on the ISR when we get the start bit and watch the input line, but that would leave us on the interrupt stack for 19.2 msec, which makes me nervous.

I'd like to use mgos_gpio_set_int_handler_isr to detect the transitions, and just record the time of transition from the high->low; after I have 64 transitions, I can decode the timestamps in the main thread and figure out what we just saw.

Can I get timer information when I am in the ISR? Do I need to drop back to using the ESP-32 hardware timers using the ESP-IDF APIs, or is there a Mongoose timer that I can (safely) access inside the ISR?

If I need to use the ESP-32 hardware timers, how do I know which ones are not in use by Mongoose?

Comments

Sign In or Register to comment.