Page 1 of 1

What is the most accurate way of determining the time between two interrupt events?

Posted: Mon Sep 16, 2024 9:52 pm
by olney_one
I am new to ESP32s. I have an application that generates two interrupts on separate GPIO lines. Accessing timestamps for real time seems to be an integer. Would using this in conjunction with a CPU clock tick count be the most accurate way of measuring the interval? Or is there a better way?

Re: What is the most accurate way of determining the time between two interrupt events?

Posted: Tue Sep 17, 2024 7:06 am
by MicroController
esp_timer_get_time() and esp_cpu_get_cycle_count() are probably the best option.
The CPU cycle count is 32 bits, so at 240MHz you can measure intervals up to ~17.9 seconds using this counter alone.

Re: What is the most accurate way of determining the time between two interrupt events?

Posted: Tue Sep 17, 2024 7:50 pm
by olney_one
Thank you, I will try this.

Re: What is the most accurate way of determining the time between two interrupt events?

Posted: Thu Sep 19, 2024 8:56 am
by olney_one
This works really well and is extremely fast. Thank you again.