
Stream UART Bytes to a Task With FreeRTOS Stream Buffers
Move UART bytes from an interrupt to a task with a FreeRTOS stream buffer: trigger level, ISR send, blocking receive and the single-writer rule.
Tag
17 posts

Move UART bytes from an interrupt to a task with a FreeRTOS stream buffer: trigger level, ISR send, blocking receive and the single-writer rule.

Move large buffers between FreeRTOS tasks and ISRs without copying them: a fixed buffer pool, a queue of small descriptors and a strict one-owner rule.

Send data from an interrupt to a task with xQueueSendFromISR: the woken-task flag, portYIELD_FROM_ISR, interrupt priority rules and a full-queue policy.

Read the oldest FreeRTOS queue item without removing it using xQueuePeek, and pair it with xQueueOverwrite to share a latest-value status between tasks.

FreeRTOS queues copy items by value so senders can reuse variables, stack data stays safe and ownership is clear. See the trade-offs and when to pass pointers.

Pass messages between FreeRTOS tasks with a queue: create it, send with xQueueSend, receive with xQueueReceive, set timeouts and check the return values.

Compare FreeRTOS, Zephyr, NuttX and ThreadX on licensing, scope, hardware support and learning curve, then pick the right RTOS with a decision table.

A superloop is fine until timing, blocking calls and feature count collide. See the signs that bare-metal firmware needs an RTOS and when it still does not.

Run a function at task level from a FreeRTOS interrupt with xTimerPendFunctionCallFromISR: arguments, config flags, failure modes and alternatives.

Detect a lost heartbeat in FreeRTOS by resetting a one-shot software timer on every message, with the timeout callback, ISR resets and per-link supervision.

Run low-priority background work in vApplicationIdleHook: enable it, keep it short and non-blocking, work in slices, and know when a task is better.

Change a running FreeRTOS timer's period with xTimerChangePeriod: what happens to the countdown, the block time, ISR use and a retry backoff example.