How to Multitask with FreeRTOS (ESP32 + Arduino series)

preview_player
Показать описание
Run multiple tasks on the ESP32 with FreeRTOS. For instance: blinking two LED's at different intervals or increment two counters at the same time.

A FreeRTOS task is nothing more than a standard C (or C++) function. Nothing fancy, very easy!

Most ESP32's have a dual-core processor, so FreeRTOS will balance your tasks across cores. This technique also works for single-core versions of the ESP32. In that case, FreeRTOS will rapidly switch between tasks, giving the impression that it's multitasking.

⚡️Other videos in this series:
(Everything you need to know about programming the ESP32 by using the Arduino Framework)

🌍 Social

(no more than once a month)
Рекомендации по теме
Комментарии
Автор

FreeRTOS was a topic that I thought was quite complex but with your explanation I finally understood how to handle it. Thank you.

portillajoe
Автор

I love how I just tried looking for generic Arduino Multitasking and I was so lucky to find this video using an esp32 with platformIO which is a prefect reference for my project.

fatheramo
Автор

Nice Entry into RTOS 👍
May I note that one should not add computation within a print function, especially if using the Arduino IDE.
In the above example the count1++ should occur outside (before) the print statement, then the value of count1 can be printed (this goes for count2 also!). To see this issue in action, change the BAUD rate to 115200 and set the second delay (task2) to 200ms. After every few iterations you will see that the print is corrupted. Move the count++ outside of the print function to fix this.
It's a very tempting short-cut, but it will bite you! 😄

adrianw
Автор

freertos is so easy to understand from you vides.I will using it in my projects, thanks.

cloudpicrc
Автор

Thank you man, you are "Simply Explained" I understood, again Tahanks.

k.k
Автор

Man... Where have you been all this time?? I searched literally everything to learn how to multitask with esp32...

ShaffleOne
Автор

This is an amazing tutorial. I've gotten an error because I wrote an infinite loop inside the task with millis() instead of calling vTaskDelay(), which would trigger the watchdog timer and reset the chip. Thanks for your kindness sharing. It does really help me a lot!

billtsou
Автор

I love this video, simplifies the concepts of RTOS

shuaibalghazali
Автор

How to calculate or view somewhere how many bytes is needed to set in task and what is the limits on esp32?

fp
Автор

How did you set it up, what library, add-on etc did you install?
Why is it not in Arduino IDE, like the title?

Chris-Brown-
Автор

How accurate is vTaskDelay? That is, is it affected by other tasks?

henrychan
Автор

Good video bro, you have my respect, +1 like

kingsoapvii
Автор

It is not clear if i have to install something to make FreeRTOS available. Also, you mentioned ESP IDF in the previous video, what is it? How can i use it? Is it an alternative to the Arduino's Framework? Wouldn't it be better to learn something native to ESP32 instead than using something that was born for a different platform (the Arduino Library) and that perhaps cannot use the full power of ESP32?

tcl
Автор

Hi, for development mode, I don't want the task to run continuously.
If I change from for(;;) to (int i = 0; i <= 4; i++) loop the task runs, but we get error "Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled." ESP32 reboots, the task runs again and reboot cycle.
Is there any work around? THanks for your help

vjreviewsandiy
Автор

I have a question for you.

Do you know of a way to install a OS from a keyboard like the Ensoniq EPS Classic or old Akai MPC drum machines on an ESP 32?

TrackAnimatorsMEDIA
Автор

Is there a way to see total compute load?

chandlerbennett
Автор

Please provide link to video where data generated in one task can be transferred to another task

yashaskumargb
Автор

Hello, How to put ISRs in core0 ? thanks in advance.

wnbrook
Автор

Can someone tell me if i need to download smtg from a library first before able to use this RTOS. The commands dont work for me

hazlamyfaizal
Автор

Maybe I am wrong and pls correct me. But freertos is included in Arduino library and it supports esp32? I mean this is already builtin library?
I guess same lib can be used for arduino boards? thanks :)

bascelik