Page 1 of 1

ESP32: which hardware timers are occupied by freertos

Posted: Sat Jan 09, 2021 12:00 pm
by kendo55
which hardware timers are occupied by freertos?
Thanks!

Re: ESP32: which hardware timers are occupied by freertos

Posted: Sat Jan 09, 2021 6:30 pm
by Victoria Nope
None of them is "occupied" by FreeRTOS. Why would they need to take them from "users"?

Re: ESP32: which hardware timers are occupied by freertos

Posted: Sat Jan 09, 2021 6:45 pm
by ESP_Dazz
Victoria Nope wrote: None of them is "occupied" by FreeRTOS. Why would they need to take them from "users"?
Generally, most operating systems have a "system tick" which requires an interrupt be generated at a regular interval. This usually requires some form of hardware timer be used to generate this system tick for the operating system.
kendo55 wrote: which hardware timers are occupied by freertos?
Thanks!
On the ESP32, none of the hardware timers are occupied. This is because the Xtensa CPU core has an internal timer to generate an interrupt at regular intervals based on CCOUNT (the CPU's clock count). Therefore, no external timer is required to generate the system tick.

Re: ESP32: which hardware timers are occupied by freertos

Posted: Mon Jan 11, 2021 7:56 am
by kendo55
Dear friends
many thanks for that good explanation

Re: ESP32: which hardware timers are occupied by freertos

Posted: Wed Aug 02, 2023 1:27 pm
by _K00CT_
I am trying to familiarise myself with the FreeRTOS config via the 'idf.py menuconfig' tool.

When I navigate to "Component config > FreeRTOS > Port > Tick timer source (Xtensa Only)", I am presented with two options:

(X) Timer 0 (int 6, level 1)
( ) Timer 1 (int 15, level 3)


Apparently, I must have one or the other selected.

This gives the impression that indeed a hardware timer is reserved by the FreeRTOS. This seems to be in contradiction with the above replies.

If it is indeed possible to configure FreeRTOS so as not to occupy any hardware timers, please could you help me understand how to achieve this (ie. by only relying on the interrupt triggered by CCOUNT).

Re: ESP32: which hardware timers are occupied by freertos

Posted: Wed Aug 02, 2023 6:05 pm
by MicroController
The SoC contains several timer components.
The TRM indicates that there are three CPU-internal timers (Timer.0-Timer.2), intended to be used for OSs' systicks & the like. These are separate from the "Timer Group" hardware timers (IDF: "General Purpose Timers"), which are external to the CPU, and are free for application code to use. Plus, there are watchdog timers and timers in other peripherals (LEDC, MCPWM,...)
AFAIK, the CPU-internal timers are not exposed to applications via IDF-API, and one of them must be selected for FreeRTOS's systick.
If it is indeed possible to configure FreeRTOS so as not to occupy any hardware timers...
How would FreeRTOS provide vTaskDelay(...) or any other time-based functionality without underlying timer hardware?

P.S.: You may want to look into the High Resolution Timer.