Finding source code for esp_timer_get_time()

damithpavithra
Posts: 13
Joined: Thu Jul 30, 2020 2:40 pm

Finding source code for esp_timer_get_time()

Postby damithpavithra » Thu Jul 30, 2020 2:50 pm

Hello
I want to find the source code (Not the header file) for the esp_timer_get_time() function.
I am using Arduino IDE to program ESP32. I searched for this function in entire ESP32 core folder, but only found the esp_timer.h file which only have the definition. Please give me a reference to find the source code.
Is it OK to use esp_timer_get_time() function in multiple tasks/cores without any mutual exclusion?.
Thank you

GE_Rita
Posts: 4
Joined: Wed Jul 22, 2020 2:50 am

Re: Finding source code for esp_timer_get_time()

Postby GE_Rita » Fri Jul 31, 2020 3:49 am

Hi, damithpavithra

I have not found its path on my Pc exactly.
It may be compiled into any (.a) file or something. Like here.https://github.com/espressif/esp-face/issues/29
But what I find is its open document. https://github.com/espressif/esp-idf/bl ... sp_timer.c
And funcions introduction.https://lang-ship.com/reference/ESP32/l ... 981faa2370
Hope it can help.

damithpavithra
Posts: 13
Joined: Thu Jul 30, 2020 2:40 pm

Re: Finding source code for esp_timer_get_time()

Postby damithpavithra » Fri Jul 31, 2020 5:19 am

Hi GE_Rita

Thank you for the reply. Seems like they pre compiled those into .a files. Dont know why they do that.
It would be really helpful to debug and learn the device if there are uncompiled source files.
https://github.com/espressif/esp-idf/bl ... sp_timer.c only have three lines which uses the function output. Not its source code.
Any idea on mutual exclusivity of the timer function?

Thank you.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: Finding source code for esp_timer_get_time()

Postby ESP_Sprite » Fri Jul 31, 2020 7:37 am

Where that function is defined depends a bit on the specific hardware timer that it's selected to use... I think by default it's timer group 0, in case the function is aliased to esp_timer_impl_get_time here, with that function defined just above that. (Note that this is for 4.2, other versions may handle this slightly different)

damithpavithra
Posts: 13
Joined: Thu Jul 30, 2020 2:40 pm

Re: Finding source code for esp_timer_get_time()

Postby damithpavithra » Fri Jul 31, 2020 7:50 am

Hello ESP_Sprite

Thank you for the help. Can you please answer this also.
I think version 4.2 is included in the latest ESP32 arduino core, right?.
Currently arduino millis function use this to get the time.
Millis is used all over the arduino. Is it ok to use millis in multiple tasks without mutual exclusivity?.
I also use a timer interrupt attached to timer 0. Is this somehow affect the millis.?

Thank you

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: Finding source code for esp_timer_get_time()

Postby ESP_Sprite » Fri Jul 31, 2020 9:52 am

Yes, that code should be re-entrant. You can also use timer0 for other purposes, esp_timer uses a legacy subsystem of the timer groups that is not usually used/usable by other code.

Who is online

Users browsing this forum: Majestic-12 [Bot], warwound and 95 guests