Searching for esp_timer_get_time() function definition

wolfrose
Posts: 16
Joined: Mon Oct 26, 2020 2:58 pm

Searching for esp_timer_get_time() function definition

Postby wolfrose » Wed May 04, 2022 1:33 am

Hi,

I'm just searching for the definition of

Code: Select all

esp_timer_get_time()
function. I searched in the core libraries but didn't find it.

I just found its calls to millis and micros in
esp32-hal-misc.c
and that's all.

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Searching for esp_timer_get_time() function definition

Postby lbernstone » Wed May 04, 2022 5:37 am

TL;DR: All ESP32 variants have a 64-bit counter that is used to keep a running count of the number of microseconds that have passed since boot, and that counter can be read with esp_timer_get_time. https://docs.espressif.com/projects/esp ... _get_timev
esp_timer_get_time is part of the esp_timer package in ESP-IDF, which is the foundation of arduino-esp32. The code is at https://github.com/espressif/esp-idf/tr ... /esp_timer, but is not a simple function, as the implementation differs in the various versions and architectures. How the counter number is generated is quite complicated and based on ticks (pulses) which typically come from the 40MHz (or 26MHz) piezoelectric crystal. If you are looking for more detail, I would refer you to the technical reference manual for the chip you are using. https://www.espressif.com/en/support/do ... -documents

Who is online

Users browsing this forum: No registered users and 75 guests