The objective of this laboratory activity is to explore and implement a real-time operating system (RTOS) on a microcontroller-based system using STM32 and Embedded C programming. Specifically, this experiment demonstrates the use of FreeRTOS to manage multiple concurrent tasks, ensuring deterministic execution, proper resource sharing, and efficient power utilization.📝Why use FreeRTOS?
FreeRTOS is a reliable, open-source real-time operating system distributed under the MIT license, offering a lightweight and trusted kernel widely used across industry. It supports over 40 MCU architectures, accelerates development through ready-to-use demos and IoT integrations, and is backed by a broad partner ecosystem. With long-term support releases, ongoing security updates, and maintenance by AWS, FreeRTOS enables faster, stable, and scalable embedded system development.
✔To start the project, prepare the following:
- RT-Thread RT-Spark Dev Board (STM32F407ZGT6)
- Breadboard
- Jumper Wires
- RGB LED Common Cathod
- Rotary Potentiometer
- STM32CUBE IDE
- Open STM32CubeIDE on the computer
- Connect the RT-Thread RT-Spark Development Board to the computer using a USB cable.
- Create a new STM32 project targeting the microcontroller used by the RT-Spark board.
- In Pinout & Configuration, find Middleware(left tab) and enable FreeRTOS when prompted so that RTOS support is included in the project.
- Open the project’s .ioc file to access the CubeMX configuration interface.
- Enable and configure the following peripherals:
- Assign pins according to the RT-Spark board schematic to avoid conflicts.
- Configure the ADC for single-channel operation.
- Set the timer output to PWM mode.
- Enable FreeRTOS middleware as mentioned above.
- Generate the initialization code.
Step 3. Integrating the LCD driver
- Include the AHT20 sensor driver files in the project.
- Add the LCD driver files:
Also take note of the following configurations:
Results/Output:
Open the link provided to view the video.
https://drive.google.com/file/d/185oUtscq8ly9DbQwehVL0KVcKTOgwgKa/view?usp=sharing
Conclusion:
In this laboratory activity, a Real-Time Operating System was successfully implemented on the STM32 RT-Spark development board using FreeRTOS. Multiple tasks were created to run concurrently, including temperature display, RGB LED brightness control, counter display, and LED blinking. Proper task scheduling and the use of a mutex ensured stable and conflict-free access to shared resources such as the LCD. Overall, this activity demonstrated how FreeRTOS improves system organization, responsiveness, and efficiency in embedded applications by allowing multiple functions to operate reliably at the same time.










_QHYKGG2j46.png)





Comments