ESP32: Arduino + FreeRTOS (in VSCode/PlatformIO)
Arduino multithreading/multicore programming for ESP32
What you’ll learn
ESP32: Arduino + FreeRTOS (in VSCode/PlatformIO)
-
You will learn how to use VSCode and PlatformIO in ESP32 Arduino projects
-
You will learn how to combine Arduino and FreeRTOS in your ESP32 project
-
You will be able to create multithreaded ESP32 applications
-
Learn thread synchronization (mutexes, semaphores, queues, event flags)
-
Critical sections and hardware interrupts
-
Arduino multicore
Requirements
-
Arduino and C/C++
Description
In this course, I will tell about multithreaded Arduino programming for ESP32. After completing it, you will learn how to combine the robust functionality of Arduino libraries with multithreaded programming for FreeRTOS.
In the first introductory lecture, I will introduce you to VSCode, which is well-suited for developing Arduino programs. We will install it and the PlatformIO extension, which allows us to compile and debug programs for Arduino. Next, we will download a simple arduino-wifiscan project provided by PlatformIO and use its example to learn how to work with projects in VSCode. Next, we will run this project on the original Arduino IDE. After that, we will open the sample project in the Arduino IDE and import it from VSCode.
In the following lecture, we will figure out how the Arduino program for ESP32 works and find its main file. Next, we will write a simple multithreaded program with three threads.
In the third lecture, we will study in detail the work of this program and use examples to understand what the priorities of tasks affect.
ESP32: Arduino + FreeRTOS (in VSCode/PlatformIO)
In the following, fourth lecture, we will begin to study ways to synchronize between tasks and change a previously written program to synchronize two threads using a mutex.
In the sixth lecture, I will show you how to synchronize tasks using semaphores. Then, in this lecture, we will study queues.
In the seventh lecture, I will talk about flags and events.
In the eighth lecture, I will tell you how synchronization is performed between hardware interrupts and tasks. We will add an interrupt from the timer to the previously written program and use its example to consider the use of flags from the interrupt. Different processor cores will be used.
Next, several more examples of multithreaded programming of ESP32 with Arduino will be considered.