ESP32: which hardware timers are occupied by freertos

kendo55
Posts: 4
Joined: Fri Aug 03, 2018 5:59 pm

ESP32: which hardware timers are occupied by freertos

Postby kendo55 » Sat Jan 09, 2021 12:00 pm

which hardware timers are occupied by freertos?
Thanks!

Victoria Nope
Posts: 75
Joined: Fri Dec 04, 2020 9:56 pm

Re: ESP32: which hardware timers are occupied by freertos

Postby Victoria Nope » Sat Jan 09, 2021 6:30 pm

None of them is "occupied" by FreeRTOS. Why would they need to take them from "users"?

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: ESP32: which hardware timers are occupied by freertos

Postby ESP_Dazz » Sat Jan 09, 2021 6:45 pm

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.

kendo55
Posts: 4
Joined: Fri Aug 03, 2018 5:59 pm

Re: ESP32: which hardware timers are occupied by freertos

Postby kendo55 » Mon Jan 11, 2021 7:56 am

Dear friends
many thanks for that good explanation

_K00CT_
Posts: 7
Joined: Thu Feb 23, 2023 9:18 am

Re: ESP32: which hardware timers are occupied by freertos

Postby _K00CT_ » Wed Aug 02, 2023 1:27 pm

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).

MicroController
Posts: 1756
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32: which hardware timers are occupied by freertos

Postby MicroController » Wed Aug 02, 2023 6:05 pm

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.

Who is online

Users browsing this forum: Google [Bot] and 77 guests