Fast timer for microsecond level duration measurements

OllieK
Posts: 58
Joined: Mon Jan 18, 2016 8:08 am
Location: USA, PA
Contact:

Re: Fast timer for microsecond level duration measurements

Postby OllieK » Thu Feb 11, 2021 4:24 am

To erase the confusion caused in this post, I have stored in GitHub a working code with documentation, sample code, and test results.
The microsecond level time measurement function timer_u32() is available in

https://github.com/OliviliK/ESP32_timer_u32

The example is timing of fibonacci function up to F92. The function takes 0.3 - 9.0 microseconds to execute. The timer_u32 uses two methods (FRC and TG0_LAC) on ESP32 and one method (SYSTIMER) on ESP32-S2.

In the original post the code was demonstrating the different results for different data types used in fibonacci function. The Github code demonstrates that the SYSTIMER or ESP32-S2 has very different speed profile than ESP32 with FRC. The FRC numbers seem to be more believable.

Perhaps there will be some follow up to explain the unexpected results. The good thing is that now I have not "found" a serious problem in ESP32 hardware. :geek:

Hr.Mitrev
Posts: 4
Joined: Tue Sep 04, 2018 2:31 pm

Re: Fast timer for microsecond level duration measurements

Postby Hr.Mitrev » Mon May 10, 2021 3:30 pm

Hi!
Sorry for the offtopic question, but I didn't want to make new thread and need more information about the LAC timer. What this abbreviation means, how the block diagram of TG0 looks so the LAC doesn't interfere with the two general purpose 64bit timers in TG0? Also is there more info for the FRC2 legacy timer?
I tried to search in the esp32 technical reference manual but couldn't find much info for the whole timer module.
I need that info because I switch my esp32 to 2MHz right after boot and stay in that frequency the whole time for energy budget reasons and while I was successfull to modify the UART, WDT and I2C modules to work fine in 2MHz, the high resulotion timer is giving me issues. Also the wakeup timer is interesting - is it somehow connected or it uses totally different periph?
I am using esp-idf v4.2 with slight mods.

Thanks :)

Who is online

Users browsing this forum: Baidu [Spider] and 120 guests