</>EmbeddedInterview

What does a UART frame look like?

EasyCommunication Protocols

Short answer: The line idles high. Each character starts with a start bit (low), followed by 5–9 data bits sent LSB first, an optional parity bit, and 1, 1.5 or 2 stop bits (high). "115200 8N1" means 115200 bits per second, 8 data bits, no parity, 1 stop bit, so each byte takes 10 bit times and the payload rate is 11,520 bytes per second.

idle ───┐ ┌──┬──┬──┬──┬──┬──┬──┬──┐ ┌─── idle
        │S│D0│D1│D2│D3│D4│D5│D6│D7│P│Stop
        └─┘                         
  (start bit = 0, data LSB first, optional parity, stop bit = 1)

Numbers to know

Baud Bit time Bytes/s (8N1)
9600 104.2 µs 960
115200 8.68 µs 11,520
1,000,000 1 µs 100,000

Details

  • Baud vs bit rate: for UART they are the same (one bit per symbol).
  • Parity: even/odd/mark/space; detects single-bit errors only.
  • Break condition: the line held low for longer than a whole frame; used as a "reset/attention" signal (LIN, some bootloaders) and appears as a framing error with data 0.
  • Idle line: the line stays high for at least one frame time; many MCUs raise an IDLE interrupt, which is very useful with DMA to detect the end of a variable-length message.
  • Inverted UART (e.g. SBUS in RC receivers) uses the opposite polarity; some MCUs can invert in hardware.