Using FreeRTOS
As we know, FreeRTOS is the official real-time OS supported by ESP32. FreeRTOS was originally designed for single-core architectures. However, ESP32 has two cores, and therefore this port of FreeRTOS is revised to handle 2-core systems as well. Most of the differences between the vanilla FreeRTOS and ESP-IDF FreeRTOS stem from this reason. For those who have some experience with FreeRTOS, it would be enough to skim through these differences:
- Creating a new task: We have a new function where we can specify on which core to run a new task; it is
xTaskCreatePinnedToCore
. This function takes a parameter to set the task affinity to the specified core. If a task is created by the originalxTaskCreate
, it doesn't belong to any core, and any core can choose to run it at the next tick interrupt. - Scheduler suspension: The
vTaskSuspendAll
function call only suspends the scheduler on the core on which it is called. The other core continues its operation. Therefore...