UART Communication: 5 Frame Parts and Baud Rate Made Easy

Share:
Digital Electronics
UART Communication: 5 Frame Parts and Baud Rate Made Easy

No clock wire, no addresses, just two devices agreeing on a speed, and yet it still carries debug logs, GPS data and Modbus RTU every day.

Tx and Rx Baud Rate 8N1 Frame Parity

A UART converts parallel data inside a chip into a stream of bits on a single wire and back again. It is asynchronous, so both ends must be set to the same speed and frame format before they can talk.

Hello everyone, today we are going to learn how UART communication works, what each bit in a frame does, how baud rate errors creep in, and how to wire two devices correctly.
UART communication

What Is UART Communication?

UART communication is a point to point, asynchronous serial link in which a Universal Asynchronous Receiver Transmitter sends data one bit at a time on a transmit line and receives on a separate receive line. It is the simplest form of serial communication found on almost every microcontroller.

Analog Devices points out that UART uses only two wires, Tx and Rx. There is no clock line, so both devices must use the same baud rate.

UART frame showing start bit, data bits, parity bit and stop bits
Image credit: Analog Devices

For UART communication, Tx of one device connects to Rx of the other, and grounds must be joined. Crossing these lines incorrectly is the most common beginner mistake.

The same UART hardware sits behind RS232 and RS485 ports, which only change the electrical levels. See RS232 vs RS485 differences for those layers.

5 Frame Parts

1
Idle
Line rests high when nothing is sent.
2
Start Bit
Line pulls low for one bit time to signal a new frame.
3
Data Bits
5 to 9 bits, least significant bit first.
4
Parity Bit
Optional even or odd check.
5
Stop Bits
One or two high bits end the frame.

The most common UART communication format is 8N1, meaning 8 data bits, no parity and 1 stop bit. Each byte therefore takes 10 bit times on the wire.

Analog Devices notes that the receiver samples the middle of each bit after detecting the start edge. Most UARTs oversample 16 times per bit to find that middle point.

How a Byte Travels

Load ByteCPU writes to the transmit register
Add FramingUART adds start, parity and stop bits
Shift OutBits leave at the baud rate
Resync on StartReceiver detects the falling edge
Rebuild ByteBits shifted into the receive register

Inside, the transmitter is a shift register, the same building block covered in sequential circuits. A FIFO buffer lets the CPU write several bytes at once.

Because every frame resynchronises on its start bit, small clock differences do not accumulate beyond one frame. That is what makes UART communication work without a shared clock.

Baud Rate and Error Formula

Divisor = f clock ÷ (16 × baud)
Actual baud = f clock ÷ (16 × rounded divisor)
Error percent = (actual minus target) ÷ target × 100

Example, 16 MHz clock:
9600 baud: divisor 104.17, rounded 104, actual 9615, error 0.16 percent
115200 baud: divisor 8.68, rounded 9, actual 111111, error 3.5 percent
Keep total error under about 2 percent per side

A 3.5 percent error can corrupt bytes, especially if the other device also runs slightly off. That is why 14.7456 MHz crystals divide exactly into common baud rates.

Throughput with 8N1 is the baud rate divided by 10. At 115200 baud, that is about 11520 bytes per second.

Signal Levels Compared

StandardLogic 1Logic 0Typical Reach
TTL or CMOS UART3.3 V or 5 V0 VCentimetres on a board
RS232Minus 3 to minus 15 VPlus 3 to plus 15 VAbout 15 m
RS485Differential A and BDifferential A and BUp to 1200 m

Never connect an RS232 port straight to a 3.3 V microcontroller pin, because the voltage can reach 15 V. Use a transceiver such as a MAX232, or an RS485 driver for long runs, see RS232 vs RS485 in automation.

Industrial protocols such as Modbus RTU run on top of UART frames. Parity and stop bit settings must match on every node.

Troubleshooting UART Communication

Garbage Characters
Baud rate or clock mismatch.
No Data
Tx and Rx swapped or no common ground.
Framing Errors
Wrong stop bits or noise.
Parity Errors
Parity setting differs.
Lost Bytes
Receive buffer overflow, add flow control.
Works Then Fails
Temperature drift of an RC oscillator.

A logic analyser that decodes UART communication makes these faults obvious. Check the bit width on a scope and compare it with 1 ÷ baud.

Hardware flow control with RTS and CTS stops overruns when one side is slow. Software flow control uses special XON and XOFF characters instead.

Baud Error Calculator

Divisor, Actual Baud and Error
Result
Divisor 9, actual 111111 baud, error minus 3.55 percent

Try 8 times oversampling to see the error fall for this case. Many microcontrollers offer a double speed mode for exactly this reason.

Advantages
  • Only two data wires.
  • No clock line needed.
  • Parity error checking.
  • Universal support.
Limitations
  • Point to point only.
  • Speed limited by clock accuracy.
  • No built in addressing.
  • Short reach at TTL levels.

TI UART Protocol PDF

PDF
UART Based Communication Protocol for Inter Module Communication
Texas Instruments application report, SLUA782

UART, I2C and SPI Explained Video

UART Communication FAQ

How many wires does UART communication need?
Two data wires, Tx and Rx, plus a common ground.
What does 8N1 mean?
8 data bits, no parity, 1 stop bit.
Why is there no clock?
Each frame resynchronises on its start bit.
What baud error is acceptable?
Keep it under about 2 percent on each side.
Is UART the same as RS232?
No, RS232 is an electrical standard used with a UART.
Which bit is sent first?
The least significant bit.
What causes framing errors?
Baud mismatch, wrong stop bits or noise.

Related Articles

External References

What We Learn Today

  • UART communication sends framed bytes on Tx and Rx without a clock.
  • Both ends must match baud rate, data bits, parity and stop bits.
  • Check baud error and signal levels before blaming firmware.
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!

Leave a Reply

Your email address will not be published. Required fields are marked *