Really Concurrent

canalrun wrote on Tuesday, March 12, 2019:

I am new to FreeRTOS.
I have two questions.

First, I am using an ESP32 processor that has two cores. I will have two continuously running tasks - one on each core. One task, running on core 0, will collect a data sample from the ADC every 1/2 millisecond and place it into a buffer. The second task, running on core 1, wil perform FFTs on the samples when a buffer becomes full. The second task takes about 10 milliseconds to complete.

Both cores need to run concurrently and independently or samples wil be lost while the FFT is processing.

Do both cores really run concurrently?

Second, I also need to blink a WiFi connected light bulb. The bulb will flash at about an 800 millisecond rate. Is it better to make this blinking part of the second “FFT” task on core 1, make it a third continuously running task that runs on core 1, or maybe use a timer that triggers a task on core 1?

What is the core processing time aritration scheme for multipe tasks on a core?

Is it cooperative? time-slice? What is the mechanism for allowing the other task to run on a core? Do I need to do a Delay or pass control back to the RTOS, or something else. It is possible that the bulb will need to blink while an FFT is busy - in this case it is not a big problem, but in the general case …


rtel wrote on Tuesday, March 12, 2019:

Do both cores really run concurrently?

Espressif have created a version of FreeRTOS that has SMP (symmetric
multi-processing) support. As far as I know, both cores will run
concurrently, but really you will have to ask them this and the other
questions as it is their implementation.