Predicting UART Receive-Buffer Overflow

Predicting UART Receive-Buffer Overflow

Try Press Step to fill the receive buffer and check its byte count while the consuming task remains paused.

Given a full receive buffer and a correctly decoded incoming byte, predict whether that byte will fit from the order of arrival and consumer service. Identify when a software receive-buffer overflow first occurs.

Serial buffers
Illustrative software receive buffer
UART decoder
Receive buffer
Consuming task
Receive buffer · Empty
EmptyFree slot
UART decoder

Framing matches and electrical levels are compatible.

Receive buffer

Empty. No overflow.

Consuming task

Paused.

Observe an empty buffer with a paused consumer

The UART can decode bytes while the task that reads them is paused.

Observe After the 64-byte burst fills the buffer, the next byte takes the free slot in the early-read lane and appears beneath the full buffer as Incoming byte discarded in the late-read lane.
Explain The late read occurs after the correctly decoded byte arrives at a buffer already holding 64 bytes, so the illustrated overflow policy discards that incoming byte.

Technical boundaries. The gapless burst uses 19,200 bit/s and 8N1, with matching framing and compatible electrical levels. The model puts decoded bytes directly into the software buffer. The illustrated full-buffer policy keeps the bytes already stored and discards the new arrival.

Back to the chapter