3.4 FreeRTOS in Zigbee Applications
For more details on queues, semaphore APIs and their usage, go to FreeRTOS™.
RTOS Tasks
- Application Task (
APP_Tasks
) – This task handles functions specific to the application. It operates under a lower priority than the Zigbee task to allow for the execution of stack operations in a timely manner. - Zigbee Task (
ZGB
) – This task receives allocation of CPU time to execute activities related to the stack. It holds a higher priority over the application task to ensure the stack operations process promptly.
In addition, the system configures the Zigbee task to wait for semaphores that specific internal stack events and RF receptions trigger, among other scenarios. This configuration enables the tasks to wait efficiently and react to events (see Figure 3-1).
Zigbee Task with RTOS
- Requests from the stack – Can consider a stack request as an interrupt on receiving a new RF packet.
- Requests from the application – An application request can involve an API call to start BDB commissioning or to retrieve the device’s short address.
After receiving a packet, the stack generates an interrupt and posts a semaphore. On the other hand, the application submits its API calls to the appQueue, which the Zigbee task, then, processes. When scheduled for execution, the Zigbee task prioritizes servicing the semaphore from stack events before addressing requests from the application. The following figure illustrates the flow diagram for the operation of the Zigbee task.