Help, My Serial Data Has Been Framed: How To Handle Packets When All You Have Are Streams
Today we're going to talk about data framing and something called COBS, which will make your life easier the next time you use serial communications on an embedded system -- but first, here's a quiz: Quick Diversion, Part I: Which of the...
Summary
This blog explains why framing is essential when you turn a byte stream (like UART) into packets and introduces COBS (Consistent Overhead Byte Stuffing) as a simple, robust framing method. Readers will learn practical techniques to delimit, detect, and recover packet boundaries on microcontrollers and embedded systems.
Key Takeaways
- Understand why raw byte streams need framing and the common failure modes of naive delimiters
- Apply COBS framing and unframing to create self-delimiting packets with bounded overhead
- Implement stream parsers that handle partial packets, dropped bytes, and resynchronization
- Use checksums/CRC and framing together to detect corruption and recover gracefully
- Integrate framed packet handling in constrained firmware (UART, DMA, ring buffers) for reliable comms
Who Should Read This
Firmware engineers and embedded developers working on microcontroller or IoT serial links who need reliable packet handling and want a practical framing solution.
TimelessIntermediate
Related Documents
- Consistent Overhead Byte Stuffing TimelessIntermediate
- PID Without a PhD TimelessIntermediate
- Introduction to Embedded Systems - A Cyber-Physical Systems Approach Still RelevantIntermediate
- Can an RTOS be really real-time? TimelessAdvanced
- Memory Mapped I/O in C TimelessIntermediate








