Home » Learning Library » Decoding a UART Serial Bus, Interactive

Learning Library · Buses and decoding · 1

Decoding a UART serial bus

UART is the simplest serial bus there is: one wire, no clock, and an agreement about speed. Type a message below and watch it leave as a train of bits, then get decoded back into text the way an oscilloscope's serial decoder does it.

Top: the whole message, with the decoded character above each frame. Bottom: a zoom on the current frame. White dots mark where the receiver samples each bit, in the middle of the bit. Tap a frame in the top view to jump to it.

Format
Bit time
Frame time
Max throughput
Current byte

Anatomy of a frame

The line idles high. Each character travels as one frame:

  • Start bit: the line drops low for one bit time. That falling edge is what the receiver synchronises on.
  • Data bits: usually eight, sent least-significant bit first. The letter U is 0x55, binary 01010101, so on the wire it reads 1, 0, 1, 0, 1, 0, 1, 0.
  • Parity bit (optional): one extra bit that makes the count of 1s even or odd, so the receiver can spot a single flipped bit.
  • Stop bit: the line returns high for at least one bit time, ready for the next start bit.

The common shorthand 8N1 means 8 data bits, no parity, and 1 stop bit: 10 bit times per character.

No clock wire, so speed is everything

bit time = 1 ÷ baud rate

Transmitter and receiver never share a clock. They agree on a baud rate in advance, and after each start edge the receiver times its way across the frame, sampling in the middle of each bit. At 9600 baud a bit lasts 104.17 µs, and an 8N1 frame takes 1.04 ms, so the line tops out at 960 characters per second. If the two ends disagree on speed by more than a few percent, the sampling points drift off the bits by the end of the frame and the data comes out garbled.

Try this

  • Type a single U. Its alternating 1s and 0s make a clean square wave, which is why it is a classic test character for checking baud rate on a scope.
  • Switch parity to Even, then Odd, and watch the extra bit flip to keep the count of 1s even or odd.
  • Change from 9600 to 115200 baud. The frame looks the same in shape. Only the time scale changes: each bit shrinks to 8.68 µs.

How a scope decodes it

An oscilloscope with serial decoding does what the bottom view shows. You tell it the baud rate, data bits, parity, and idle polarity. It finds each start edge, samples mid-bit, assembles the bytes, and prints them over the waveform in hex or ASCII. Seeing the decoded byte next to the analog signal is what makes problems like a wrong baud rate, a missing stop bit, or a noisy edge quick to spot.

Logic-level UART, as used between microcontrollers, idles high at the supply voltage, typically 3.3 V or 5 V. RS-232 carries the same frames, but inverted and at higher voltages of roughly ±5 V to ±15 V. Decoding RS-232 means setting the decoder to inverted polarity.

Decode real traffic. Oscilloscopes with serial bus triggering and decoding.

Shop UNI-T oscilloscopes

UNI-T Learning Library. Design. Debug. Deploy.™