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 Example using Timer TG0 as 100uS irq Timer #include <stdio.h> #include <string.h> #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "rom/ets_sys.h" #include "rom/gpio.h" #include <stddef.h> […]

Read More

Delays

Delay in mS vTaskDelay(2000 / portTICK_PERIOD_MS);   The RTOS tick period is (by default) 10ms N.B. We've found using a value less than the RTOS tick rate, so (10 / portTICK_PERIOD_MS), results in a delay of 100mS regardless of the value used!  Even vTaskDelay(10) does it.  This seems like it must be a bug that […]

Read More