What is the most accurate way of determining the time between two interrupt events?
What is the most accurate way of determining the time between two interrupt events?
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?
-
- Posts: 1707
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: What is the most accurate way of determining the time between two interrupt events?
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.
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?
Thank you, I will try this.
Re: What is the most accurate way of determining the time between two interrupt events?
This works really well and is extremely fast. Thank you again.
Who is online
Users browsing this forum: No registered users and 84 guests