UART

From RS-485

UART (Universal Asynchronous Receiver-Transmitter)[edit | edit source]

Introduction[edit | edit source]

UART (Universal Asynchronous Receiver-Transmitter) is a hardware communication module used for asynchronous serial communication between devices. It is one of the simplest and most widely used serial interfaces in embedded systems, microcontrollers, and communication modules.

UART defines only the data framing and timing at the logic level and requires a separate physical layer such as TTL-level signaling, RS-232, or RS-485.

Core Principle[edit | edit source]

UART transmits data serially (bit by bit) without a shared clock signal between devices. Instead, both devices agree on a fixed baud rate.

Each data frame is synchronized using:

  • Start bit (synchronization)
  • Data bits (payload)
  • Optional parity bit (error detection)
  • Stop bit(s) (frame end)

UART Frame Structure[edit | edit source]

A standard UART frame consists of:

| Start | Data Bits | Parity (optional) | Stop Bits |
|   0   | 7–9 bits  | 0 or 1 bit        | 1–2 bits  |
Start Bit
Always logic 0. Signals the beginning of transmission.
Data Bits
Typically 7, 8, or 9 bits. Most common is 8-bit data.
Parity Bit (Optional)
Used for simple error detection:
  • Even parity
  • Odd parity
  • None
Stop Bits
Logic 1 state used to mark end of frame (1, 1.5, or 2 bits)

Baud Rate[edit | edit source]

UART communication depends on a pre-agreed baud rate.

contentReference[oaicite:0]{index=0}

Common baud rates:

  • 9600
  • 19200
  • 38400
  • 57600
  • 115200
  • 921600 (high-speed UART)

Timing accuracy is critical:

  • Typical tolerance: ±2% to ±5%

UART vs Serial Communication[edit | edit source]

UART is a specific implementation of asynchronous serial communication.

  • Serial communication = general concept
  • UART = hardware implementation of asynchronous serial

UART is often used as:

  • Data link layer inside microcontrollers
  • Interface to physical standards (RS-232, RS-485 via transceivers)

Electrical Levels[edit | edit source]

UART itself does NOT define electrical voltage levels.

It can operate on different physical layers:

TTL UART
  • Logic levels: 0 V (LOW), 3.3 V or 5 V (HIGH)
  • Used inside microcontrollers
RS-232 UART
  • Uses ± voltage levels (inverted logic)
  • Requires level shifting (e.g., MAX232)
RS-485 UART
  • Uses differential signaling (A/B lines)
  • Requires transceiver (e.g., MAX485)

Signal Lines[edit | edit source]

Minimal UART connection:

  • TX (Transmit)
  • RX (Receive)
  • GND (Ground)

Cross-connection:

  • TX → RX
  • RX → TX

Optional:

  • RTS / CTS (hardware flow control)

Full-Duplex Operation[edit | edit source]

UART supports full-duplex communication:

  • TX and RX operate independently
  • Data can be sent and received simultaneously

Flow Control[edit | edit source]

To prevent buffer overflow, UART may use flow control:

Hardware Flow Control
  • RTS (Request To Send)
  • CTS (Clear To Send)
Software Flow Control
  • XON / XOFF characters

Timing and Sampling[edit | edit source]

Since there is no clock line, timing is critical:

  • Receiver detects start bit edge
  • Samples data bits at center of bit period
  • Uses baud rate to estimate timing

Clock drift between devices can cause:

  • Framing errors
  • Bit misalignment

Error Detection[edit | edit source]

UART provides limited error detection:

  • Parity bit (optional)
  • Framing error (invalid stop bit)
  • Overrun error (buffer overflow)

UART does NOT provide:

  • Retransmission
  • Acknowledgement
  • Strong error correction

Common Errors[edit | edit source]

  • Baud rate mismatch
  • Incorrect parity settings
  • Reversed TX/RX wiring
  • Missing ground reference
  • Noise on long cables
  • Wrong stop bit configuration

Physical Layer Relationship[edit | edit source]

UART is NOT a physical standard. It requires external interfaces:

  • TTL UART → microcontroller pins
  • RS-232 → PC serial ports (legacy)
  • RS-485 → industrial networks
  • RS-422 → long-distance links

UART defines only:

  • Frame structure
  • Timing
  • Bit-level protocol

Applications[edit | edit source]

UART is widely used in:

  • Microcontroller debugging (serial console)
  • GPS modules
  • Bluetooth modules (HC-05, HC-06)
  • Wi-Fi modules (ESP8266/ESP32 AT commands)
  • Industrial sensors
  • Embedded device communication
  • Bootloaders and firmware flashing

Advantages[edit | edit source]

  • Extremely simple hardware implementation
  • Low resource usage
  • Wide compatibility
  • Flexible baud rate configuration
  • Easy debugging and testing
  • Works with multiple physical layers

Limitations[edit | edit source]

  • No built-in addressing
  • No robust error correction
  • Sensitive to timing mismatch
  • Limited distance (depends on physical layer)
  • No native multi-device bus support

Debugging Tips[edit | edit source]

  • Verify TX/RX crossover
  • Check baud rate and frame settings
  • Ensure shared ground reference
  • Use logic analyzer for signal inspection
  • Test loopback mode (TX → RX shorted)
  • Reduce baud rate for stability testing
  • Check for noise on long cables

Typical UART Waveform[edit | edit source]

A UART frame appears as:

  • Idle state: HIGH (logic 1)
  • Start bit: LOW
  • Data bits: sequential LSB first
  • Stop bit: HIGH

Relationship to Other Standards[edit | edit source]

UART is commonly used with:

  • RS-232 (PC serial ports)
  • RS-485 (industrial multi-drop networks)
  • RS-422 (long-distance point-to-multipoint)
  • Modbus (protocol over UART/RS-485)

Conclusion[edit | edit source]

UART is one of the most fundamental building blocks of digital communication systems. While simple in design, it forms the foundation for many industrial and embedded communication protocols when combined with appropriate physical layers such as RS-232 or RS-485.

Understanding UART is essential for working with microcontrollers, embedded systems, and serial communication in general.

See Also[edit | edit source]

External References[edit | edit source]

  • Microcontroller UART datasheets (STM32, AVR, ESP32)
  • Texas Instruments UART application notes
  • ARM Cortex-M serial communication documentation