This repository integrates theoretical and technical knowledge on how to build multitasking and real-time applications for STM32 architectures. The examples incrementally explore concurrency problems such as task creation, critical sections, inter-task communication, and many topics of interest. The examples were coded on the STM32F767ZI board. However, they should work on other STM32 base architectures.
The development chain that I used was STM32Cube and STM32CubeIDE. For UART serial communication, I have used both the Hercules or MobaXterm terminals. Projects were flash with the Segger J-link debugger probe. An alternative probe that is often recommended is ST-Link/V2. Projects use the FreeRTOS operating system.
Projects are labeled as follows: board type
+ CMSIS version
+ small description of the problem being addressed
. i.e.: F767ZIV1_Task_creation
. Many of the examples are for educational purposes. These are based on Jim Cooling book on Real-Time Operating Systems and Richar Barry book technical manual on mastering the FreeRTOS Real Time Kernel. Some of the projects require additional hardware in order to observe the task behavior. Thus, you might need to build the following circuit.
Pins are connected as described in Table I. I listed the pin layouts for different board architectures. If you have a different board layout, you must proper connect your board to the circuit as specified in the board schematics.
Board | STM32 Pin | Board Pin | Label | Class |
---|---|---|---|---|
F767ZI | PA3 | A0 | EGreen |
GPIO_Output |
PC0 | A1 | EBlue | GPIO_Output |
|
PC3 | A2 | ERed | GPIO_Output |
|
PF3 | A3 | EYellow | GPIO_Output |
|
F042K6 | PB3 | D13 | Green |
GPIO_Output |
PA12 | D2 | Blue | GPIO_Output |
|
PB7 | D4 | Red | GPIO_Output |
|
PF0 | D7 | Yellow | GPIO_Output |
|
L432KC | PB3 | D13 | Green |
GPIO_Output |
PA12 | D2 | Blue | GPIO_Output |
|
PB7 | D4 | Red | GPIO_Output |
|
PC14 | D7 | Yellow | GPIO_Output |
Following Graham et. al. notation for theoretic scheduling problems. Most of the projects are classified as 1|r_j, w_j, pmnt with 1 processing unit, r_j tasks released times are known, w_j tasks priorities are given, and pmnt preemtions are allowed. In each project folder comes with a PDF file that defines the hardware and operating system setup. The following table describes the problem model that each project addressed.
Project label | Problem model |
---|---|
F767ZIV1_Persistent_task | A single persistent toggles an LED at 0.5Hz. Premptions are allowed. |
F767ZIV1_Periodic_task | A single periodic task toggles an LED at 0.5Hz. The task is periodically executed each 2s. Premptions are allowed. |
F767ZIV1_PPM | Two periodic tasks execute. The firt executes for 4s and toggles an LED at 20Hz, the second task executes for 1s toggles an LED at 20Hz. Equal task priorities are considered. Priority preemptive is applied |
F767ZIV1_Contention | Two periodic tasks execute. They have different release times and durations. Contention, when accesing a shared function, is illustrated by enabling a blue LED. Preemptions are allowed. |
F767ZIV1_Disabling_interrupts | Contention problems observed in F767ZIV1_Contention are solved by disabling interrupts |
F767ZIV1_Disabling_scheduler | Contention problems observed in F767ZIV1_Contention are solved by disabling the scheduler |
Contributers:
- Leobardo Argiles