FreeRTOS Task Switch Example
This example demonstrates task switching and inter-task communication using FreeRTOS. Two tasks, “Main” and “Pong”, interact using semaphores and software interrupts to illustrate context switching and synchronization in a real-time operating system.
This example operates as follows:
The application initializes two tasks:
Main Task (higher priority)
Pong Task (lower priority)
The Main Task triggers a software interrupt, which signals the Pong Task via a semaphore.
The Pong Task, upon receiving the semaphore, triggers its own interrupt to signal back to the Main Task.
This ping-pong process repeats for a fixed number of iterations.
The example logs progress and indicates success or failure via console output.
Key features demonstrated:
FreeRTOS static task and semaphore creation
Task synchronization using binary semaphores
Software interrupt registration, triggering, and handling
Context switching between tasks of different priorities
External Connections
None