The short answer is yes, UART is generally considered to be the same as serial communication. UART stands for Universal Asynchronous Receiver/Transmitter and it is a hardware protocol that allows serial communication between devices.
What is UART?
UART is a hardware protocol that handles asynchronous serial communication. It provides the following main functions:
- Transmitting bytes of data one bit at a time sequentially
- Receiving bytes of data one bit at a time sequentially
- Sending and receiving bytes without a synchronizing clock signal
Some key features of UART communication include:
- Asynchronous – There is no clock signal to synchronize the sending and receiving devices
- Full duplex – Can transmit and receive data simultaneously
- Serial – Data is sent one bit at a time sequentially over a single communication line
- UART uses two data lines for communication – a transmit (TX) line and a receive (RX) line
The UART protocol handles all the bits and byte sequencing, parity, start/stop bits and flow control needed for asynchronous serial communication. A UART controller chip handles all the timing and protocol requirements on both ends of the serial link.
UART Frame Format
When UART transmits data serially, it formats the data into individual frames. Each frame contains the data byte along with start bits, stop bits and optionally a parity bit.
The frame format consists of:
- Start bit: Indicates the start of data, always held low/0
- Data bits: The data byte being transmitted, usually 5-8 bits
- Optional Parity bit: For error checking
- Stop bits: Indicates end of data, always held high/1, usually 1-2 bits
For example, a common UART frame sending an ASCII “A” character would look like:
- Start bit: 0
- Data: 0100 0001 (ASCII “A”)
- Parity: 0 (even parity)
- Stop bit: 1
The UART transmitter sends each bit in this frame sequentially from start to stop. The receiver clocks in each bit as it comes in and assembles the frame. Once the stop bit is received, the UART receiver has the complete data byte.
UART Configuration
There are a few key parameters that need to be configured correctly for two UARTs to communicate with each other:
- Baud rate – The speed at which data is transmitted, measured in bits/second.
- Data bits – The number of bits in each transmitted byte, usually 5-8 bits.
- Parity – Adds an extra parity bit for basic error checking. Options are odd, even or none.
- Stop bits – The number of stop bits, usually 1 or 2.
- Flow control – Optional handshaking for flow control, e.g. CTS/RTS.
As long as both the transmitter and receiver UARTs have matching configurations, they will be able to communicate serially.
UART vs Serial Communication
The term “serial communication” refers to any communication scheme that transmits data one bit at a time sequentially over a single communication line or channel. Some examples of serial interfaces include:
- UART
- RS-232
- I2C
- SPI
- USB
UART is one specific way to implement serial communication. It provides asynchronous serial communication using start/stop bits and does not need a clock signal to synchronize communication. This allows UART to be implemented in software on microcontrollers and in dedicated hardware UART chips.
Some key differences between UART and broader serial communication systems like RS-232 are:
- UART is asynchronous while RS-232 can be asynchronous or synchronous.
- UART uses 2 wires while RS-232 can use up to 25 wires.
- UART has limited distance and speed compared to RS-232.
- RS-232 defines electrical signal levels, whereas UART does not.
However, the simplest forms of RS-232 communication often use just 2-3 wires, so at those levels UART and RS-232 are quite similar in implementation.
In summary, UART is a widely used specific form of asynchronous serial communication. While there are other serial protocols, UART is by far the most common serial implementation, especially for embedded systems. So while UART != Serial in theory, in practice most serial communication uses UART or a UART-like implementation.
UART Applications
Some common applications and devices that use UART communication include:
- Microcontrollers – Nearly all microcontrollers have UART peripherals for serial communication with other devices.
- Serial ports – Most computers have a UART-based serial port for communicating with peripherals.
- RS-232 interfaces – Most short-distance RS-232 communication is done using UART.
- Bluetooth, WiFi, Ethernet – UART is used internally in chips that implement wireless communication protocols.
- GPS modules – GPS receivers provide location data over a UART interface.
- Serial mice, modems, printers – Common peripherals that connected to computers using serial UART interfaces.
Because UART is simple to implement in hardware and software, it is the most common way to add serial communication capabilities to any device. Even when using higher level protocols like USB, UART is typically used internally to handle the serial data transmission.
UART in Microcontrollers
Nearly all microcontrollers have built-in UART peripherals to enable serial communication. Here are some ways UART is used in microcontroller applications:
- Debugging – UART provides a simple serial interface for debugging and sending messages from a microcontroller.
- Connecting to PCs/hosts – UART allows microcontrollers to communicate with PCs and hosts using a simple serial interface.
- Sensor/peripheral interfaces – UART provides a standard method for microcontrollers to interface with various serial sensors and devices.
- Multi-microcommunication – UART enables serial communication between multiple microcontrollers in the same design.
Most microcontrollers provide at least one or two built-in UART peripherals. These handle all the asynchronous serial transmission so the microcontroller CPU core does not have to control individual bits/bytes. Common features include:
- Separate transmit and receive blocks
- FIFO buffers for transmit and receive data
- Programmable baud rate generator
- Data format configuration options
- Interrupt generation
This built-in UART peripheral makes it very easy for any microcontroller to add serial communication capabilities. UART provides an efficient asynchronous serial interface that requires minimal CPU overhead for most embedded applications.
Summary
- UART stands for Universal Asynchronous Receiver/Transmitter and provides asynchronous serial communication.
- UART handles all the transmission of data bits sequentially along with parity, start and stop bits.
- UART is a widely used hardware protocol that implements asynchronous serial communication.
- While not identical, UART and serial communication are often used interchangeably in practice since UART is so ubiquitous.
- UART enables simple and efficient serial interfaces between microcontrollers, PCs, modules and other devices.
So in summary, while UART and serial communication are not technically the same thing, UART has become synonymous with asynchronous serial communication in most cases. When people refer to a “serial interface”, they are generally referring to a UART or compatible interface the vast majority of the time.