Universal Asynchronous Receiver-Transmitter (UART)

 

The UART, pronounced ' you-art ', is an asynchronous serial communication protocol, which the data format and transmission speeds are configurable. UARTs are now commonly included in microcontrollers.

Data Packet Format

UART transmitted data is organized into packets. Each packet contain [1 START bit ] + [ DATA frame (5 ~ 9 bits) ] + [ PARITY bit (optional) ] + [ STOP bit (1, 2) ], as shown in the following diagram.

UartProtocolFormat s

  • START bit
    In the Idle mode, the UART data line is held at high voltage level (logic 1). To start data transmission, the transmitting UART pulls the transmission line to low for one clock cycle. When the receiving UART detects the data line from high to low voltage transition, it begins reading the bits in the data frame at the frequency of the baud rate.
  • DATA frame
    The data frame contains the data being transferred. Options are 5, 6, 7, 8 (default), or 9. If the PARITY bit is not used, the length of the data frame could be up to 9-bits; if a parity bit is used, the maximum length of the data frame is up to 8-bits.
  • PARITY bit
    The parity bit is for error checking when the receiving UART receives a packet. This can be set to None (default), Odd, Even, or Mark/Space. If the data frame is 9-bits, then the Parity type must be Mark/Space.
  • STOP bits
    To signal the end of the data packet, the sending UART drives the data transmission line from a low voltage to a high voltage. The STOP bit can be set to 1 (default) or 2 bits.

Baud Rate

The baud rate specifies how fast data is sent over a serial line. The units of the baud rate are bit-per-second (bps). The higher a baud rate goes, the faster data is sent and received, but the speed of data transfer us limited. Since there is no clock signal in the UART communication, the higher transmitting speed will easy leading to get errors on the receiving end. The standard bud rate is shown as the following table:

How UART Works?

UARTs transmit data asynchronously, which means there is no clock signal to synchronize the data bits from the transmitting UART to the receiving UART. Typically, an asynchronous communication needs handshaking signals to ensure sender and receiver to coordinate data transfers. In the UART, there are no extra handshaking signals between the transmitter and receiver. The transmitter generates a bit stream based on its clock signal, and then the receiver's goal is to use its internal clock signal to sample the incoming data. Therefore, the transmitter and receiver both need to have same transfer speed and data packet format. Then, the receiver's UART resynchronize the internal clocks on the falling edge of the start bit,and then read the center of each expected data bit based on the baud rate that is set.

 

UART Configuratios

Both UART communicating devices must operate at the same baud rate and have same configuration for successful communication:

  • Baud Rate
    • Standard Mode: 110 to 115,200 bps
    • Fast Mode: 230,400 ~ 921,600 bps, up to 4 Mbps
  • Modes: Full duples, half duplex, TX only, RX only
  • Data Bits: 5 ~ 9 bits
  • Endianess: Some UART devices offer the option to send the data in either LSb or MSb. The UART is almost always LSb.
  • Parity Types: None, Even, Odd, Mark/Space
  • Stop Bits: 1 or 2
  • Flow Control: None, Hardware

Go to top