Skip to main content

Introduction to FreeRTOS

Particularly for IoT uses, FreeRTOS is a well-known open-source RTOS kernel found in embedded systems.

FreeRTOS has three basic ideas guiding its design:

  • Simplicity: Simple to grasp and put to use.
  • Portability: It can operate on several different processor systems.
  • Flexibility: Lets you change things depending on what you need.

Many architectures are supported by FreeRTOS, including ARM, AVR, PIC, MSP430, and ESP32. It also works with a variety of platforms, like Arduino, Raspberry Pi, and even AWS IoT.

Important aspects and services provided by FreeRTOS consist of:

1. Task


FreeRTOS lets you build and manage several tasks that may run simultaneously across several processor cores or on a single core. 
 Every task includes: 
 - Priority will decide the sequence of execution. 
 - Manage memory usage by stack size. 
 - Optional name meant to help with task management and bug fixes. 
 
API allow users to create, remove, suspend, resume, postpone, or synchronize tasks. 

2. Queue


For synchronization and inter-task communication, FreeRTOS offers queues. 
 - A data structure storing a set of objects is called a queue. 
 - Through queues, tasks can send and retrieve data. 
 - Queue can also be used to enforce access-control by means of semaphores and mutexes. 

3. Timer


FreeRTOS has software timers that allow:
- Execution of a callback function periodically or one-shot.
- Timer objects with properties such as period, expiry time, and optional name.
- Timers can be created, deleted, started, stopped, and reset using the available APIs.

4. Event Groups


Event groups are used to signal between tasks or between tasks and interrupts. Characteristics include:
- Based on bit flags that can be set or cleared individually or together.
- Tasks can wait for one or more specific bits in an event group to be set before proceeding, using the provided APIs.

5. Notification


FreeRTOS provides task notifications for lightweight and fast communication between tasks or between tasks and interrupts. Key points:
- Notifications are 32-bit values sent to a task using APIs.
- They might serve as basic data values, mutexes, event flags, or even a semaphore.