System 1uS timer

esp_timer_get_time starts counting from 0 at startup / wake from deep sleep. It increments every 1uS int64:0x0000000000000000 to 0x7FFFFFFFFFFFFF9,223,372,036,854,775,807 uS9,223,372,036,854 seconds153,722,867,280 minutes2,562,047,788 hours106,751,991 days292,471 years Using esp_timer_get_time to time things

Read More

FreeRTOS Tick Rate

Defaint is 100Hz / 10mS You can change it with make menuconfig: Component config > FreeRTOS > Tick Rate (Hz) Whacking it all the way up to 1000 will cause some things to be affected as the scheduler has less time to deal with calling different tasks.  

Read More

Background Timers

Get time in uS since powerup int64_t esp_timer_get_time() esp_timer_get_time() returns 64-bit time since startup, in microseconds. int64 = 292,471 years before overflow at uS resolution! Unlike gettimeofday function, values returned by esp_timer_get_time() start from zero after startup of the chip wakes up from deep sleep and do not have timezone or DST adjustments applied.    

Read More

Hardware Timers

ESP32 has 4 individual hardware timers, arranged as 2 timers x 2 timer groups. All 4 are 64-bit generic timers based on 16-bit prescalers and 64-bit auto-reload-capable up / down counters. Resources https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/timer.html CMakeLists.txt REQUIRES Ensure the following is added to the REQUIRES section of your CMakeLists.txt file in the \main folder: Example using Timer […]

Read More

Delays

Delay in mS The RTOS tick period is (by default) 10ms N.B. vTaskDelay is no good for small mS delays. It is based on the RTOS tick rate. If you select a value < portTICK_PERIOD_MS you may get a zero delay or you may get a delay of portTICK_PERIOD_MS (so 10mS). We’ve also found instances […]

Read More