UART stands for Universal Asynchronous Receiver/Transmitter. It is a computer hardware device that translates data between parallel and serial interfaces. UARTs are commonly used for serial data communication between a computer and peripherals such as mice, modems, and printers.
Overview of UART
A UART consists of two main components – a transmitter and a receiver. The transmitter converts parallel data from the CPU into serialized form and sends it out over a communication channel. The receiver takes in serial data and converts it back into parallel format for the CPU to process.
Some key characteristics of UARTs:
- Asynchronous – The transmitter and receiver operate independently without a synchronizing clock signal.
- Full duplex – Transmission can occur in both directions simultaneously.
- Serial interface – Data is sent and received one bit at a time sequentially over a communication line.
- Parity checking – Basic error detection using a parity bit can be implemented.
The UART uses two data lines for sending and receiving data – a Tx line for transmitting and an Rx line for receiving. It also requires other control signals like chip select and interrupt signals for coordination between the transmitter and receiver.
UART Frame Format
Data transmitted by the UART follows a specific frame format consisting of:
- Start bit – Indicates the beginning of data transmission. It is normally a logical 0.
- Data bits – The actual data being transmitted, usually 5-8 bits.
- Parity bit – Optional bit for basic error checking.
- Stop bits – Indicates the end of the data frame. Usually 1, 1.5 or 2 stop bits.
For example, a common UART frame sending an ASCII character contains 1 start bit, 8 data bits, 1 parity bit, and 1 stop bit resulting in a total of 11 bits.
UART Communication Standards
Some common UART communication standards include:
- RS-232 – Most common UART protocol using +/- 12V signaling levels. Used for serial ports and modems.
- RS-422 – Differential signaling standard for longer distances up to 1000m.
- RS-485 – Allows multiple devices to communicate on the same bus.
- USB – Universal Serial Bus implements serial communication over USB ports.
- UART over Bluetooth – Enables wireless serial communication with Bluetooth modules.
A UART controller is the hardware module that handles all the UART functionality. It manages the timing requirements, parity checking, interrupts and buffering of data during UART transmissions.
UART controllers can be built into ICs like general-purpose microcontrollers or implemented as a dedicated serial port adapter on PC expansion cards and embedded systems. Some examples of common UART controllers include:
- 16C550, 16450, 16550, 16650 and 16750 UARTs from chip vendors like Intel and National Semiconductor widely used in PCs.
- PL011 UART built into ARM Cortex-M and Cortex-A processor cores.
- Zilog Z16C30 and 85C30 Serial Communications Controllers (SCC).
- Microchip 8250 and Maxim MAX3100E UART controllers for embedded designs.
The UART controller handles all the timing and protocol requirements like start/stop bits, parity etc. so the CPU is relieved from directly handling serial communication.
UART Hardware Interfaces
Different types of hardware interfaces are used to connect the transmitting UART with the receiving UART over a serial communication link. Some common interfaces include:
- RS-232 – Connects two DTEs like computers using DB-9 connectors. Limited to short 15m distances.
- RS-422 – Balanced and differential signaling allows 1Mbps data rates over 1200m.
- RS-485 – Multipoint bus allows multiple devices to share a common RS-485 bus.
- USB – Built-in USB to UART bridge chips like FT232RL ease UART interfacing.
- Bluetooth – Bluetooth serial port profile (SPP) replaces cables with wireless connectivity.
- PCI/PCIe – UARTs implemented on PCI/PCIe cards provide serial ports in PCs.
Choosing the right interface depends on the communication distance, environment, speed and number of devices needed.
Some common applications where UARTs are used include:
- Serial ports on PCs like COM and RS-232 ports.
- Embedded systems use UART for debug console access, kernel logging.
- Connecting peripheral devices like modems, printers, GPS modules.
- UART over USB provides virtual COM ports for easy PC connectivity.
- Implementing serial protocols like Modbus, DMX512 lighting control.
- Interfacing with Bluetooth and WiFi modules that use UART connections.
Because of its simplicity and ubiquity, UART remains a popular serial communication interface for a wide variety of applications even in the era of fast Ethernet and USB networks.
Advantages of UART
Some of the key advantages of using UART for serial communication include:
- Simplicity – UART design is simple with just a transmitter, receiver, and a few control signals.
- Ubiquity – UART is implemented in almost all microcontrollers and processors.
- Low cost – Requires just a few inexpensive components like baud rate generator, buffers.
- Full-duplex – Allows simultaneous two-way data transfer.
- Asynchronous – No clock synchronization necessary between transmitter and receiver.
- Long distance – Differential signaling of RS-485 allows distances up to 1.2 km.
Due to these benefits, UART remains the serial interface of choice for embedded and peripheral device communication in many systems.
Disadvantages of UART
Some drawbacks of using UART include:
- Lower speed – UART speed is limited to 115 Kbps for longer cabling without additional driver electronics.
- Software overhead – OS has to handle interrupts and buffer serial data from the UART.
- Limited error checking – Only simple parity checking available.
- Hardware handshaking – Slow compared to software handshaking protocols like XON/XOFF.
- Single master – RS-485 bus allows only a single master UART transmitter.
- Cable length limits – RS-232 limited to just 15m without signal boosting.
For very high speed or long distance communication, differential interfaces like Ethernet and fibre optic links are usually preferred over UART.
The Universal Asynchronous Receiver/Transmitter (UART) is a versatile and ubiquitous serial communication interface found in many devices today. Using very few components, UART allows easy conversion between parallel and serial data with basic hardware flow control and error checking features. Various serial standards like RS-232, RS-422, RS-485 define electrical signaling details and cabling for different applications. UARTs are commonly used for serial ports, debugging, connecting peripherals and implementing serial protocols on embedded systems and PCs alike due to their simplicity and flexibility.