Library
Embedded Systemsintermediate3 min readNov 24, 2026

UART Framing From Scratch

Decode an unknown serial protocol safely: idle state, baud estimation, framing and decoder construction.

Confirm the physical layer

Idle-high with a start bit pulling low is the UART signature. Idle-low suggests inverted logic or RS-485 differential — check before attaching a decoder.

Estimate baud empirically

Capture a repeating byte and measure the shortest pulse. Baud is approximately 1/pulse width. Test candidate rates against a known transmission pattern.

Build the decoder

Most analysers accept a custom decoder definition: start bit, data bits, parity, stop bits. Validate against a byte you can predict from device behaviour.

Separate framing from payload

Once frames decode cleanly, map field boundaries by varying one input at a time and watching which bytes shift. Checksums usually sit in the final byte and change with every other field.

Protect the bus

Use a buffer or series resistor on 5 V logic feeding a 3.3 V analyser, and share ground. Never probe a live automotive bus without a transceiver.