June 18, 2026
UART has no notion of a frame. A receiver that connects in the middle of a transfer needs some way to find the start. Consistent Overhead Byte Stuffing solves this by removing every zero byte from the encoded frame, so a zero can act as the delimiter.
Each zero is replaced by the distance to the next zero, and the first byte of the frame points at the first zero. For example:
data: 11 22 00 33 frame: 03 11 22 02 33 00
Here 03 says the next zero was three positions ahead, 02 starts the following one-byte block, and the final 00 ends the frame.
The overhead is predictable: one byte per 254 bytes of data, or a little under half a percent in the worst case. SLIP-style byte stuffing can double the length in the worst case.
The receive buffer has to hold the longest frame plus the overhead. After an overflow the receiver just waits for the next zero and starts over. COBS does not check integrity, so you still want a checksum.