ESP32 Timer precision
Closed this issue · 3 comments
During compilation I slapped my face into this message
"ESP8266 / ESP32 can only reach a ms resolution so any us interrupt will be rounded to that"
Reference:
Line 108 in 848ebf1
Apparently, ESP32 does not have this limitation which sounds very weird for any microcontroller.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/esp_timer.html#obtaining-current-time
Maybe the one used in this library is not the the right timer.
Am I missing something?
Thank you!
Hello,
As stated on header, I use RTOS Timer to provide support:
Line 13 in 848ebf1
This timer has 1ms resolution, hence that message.
I've looked your documentation and it's possible to use a hardware timer in a secure way, so I'll modify the code to do so. Thanks for the hint!
Cheers!
P.S.: ESP Arduino support is based on FreeRTOS, that's why I didn't want to touch hardware directly: https://techtutorialsx.com/2017/05/06/esp32-arduino-using-freertos-functions/
That's great, thanks for the prompt answer.
Given the ESP32 has a supersonic speed in comparison to the standard microcontroller, I bet the ability of controlling more fine-grained timer is popular :)
Hello again!
I've integrated OS hardware timer on ESP32. ESP8266 lacks that class, so I've splitted both and ESP8266 still uses ticker.
I'll check if ESP8266 has any similar class when I have some time....
Thanks for the hint!
Cheers!
Daniel.