What Is UART (Universal Asynchronous Receiver-Transmitter)?
Last updated 26 June 2026 · 7 min read
Direct Answer
UART (Universal Asynchronous Receiver-Transmitter) is a serial hardware protocol that transmits data asynchronously — with no shared clock — over two signal lines: TX (transmit) and RX (receive). Both ends must be independently configured to the same baud rate, data-bit width, parity setting, and number of stop bits before communication can succeed. UART is the simplest common serial protocol: strictly point-to-point, low pin count, and available as a built-in peripheral on virtually every microcontroller.
Detailed Explanation
UART is the oldest and simplest of the common embedded serial protocols. Unlike SPI and I2C, which use a shared clock line to synchronise bit sampling, UART is asynchronous — each end runs its own clock, and both sides must be independently configured to the same timing parameters before any data is exchanged.
The UART frame
Every UART transmission is structured as a sequence of discrete frames, each carrying one character:
- Start bit — a single logic-low bit that signals the beginning of a new frame. The line idles high, so the falling edge alerts the receiver's baud-rate sampler to start counting bit periods.
- Data bits — typically 8 bits, transmitted LSB first. (5, 6, 7, or 9 bits are defined in the standard but uncommon in practice.)
- Parity bit (optional) — an extra bit for simple error detection. Even parity means the total count of 1-bits across data plus parity is even; odd parity makes it odd. Most embedded links use no parity (N) and rely on higher-layer checksums instead.
- Stop bit(s) — one or two logic-high bits that signal the end of the frame and give the receiver time to prepare before the next start bit. Two stop bits are used for slow receivers or long cable runs at high baud rates.
The most common configuration is 8N1 — 8 data bits, No parity, 1 stop bit. This is what 115200 8N1 in a serial terminal refers to.
Baud rate
Baud rate is the number of symbol transitions per second, which for UART equals bits per second. Standard rates are 9600, 19200, 38400, 57600, 115200, 230400, and 921600 baud. In practice, 115200 is the modern default for debug consoles and module interfaces; 9600 is a legacy rate that remains common for GPS NMEA sentences.
Both ends must be configured to exactly the same baud rate. A mismatch of even 2–3% causes the receiver to mis-sample bit boundaries, producing a stream of garbage characters or silent reception failure. Most microcontroller UART peripherals derive their baud rate from the peripheral clock via an integer (or fractional) divisor — always verify the actual achieved rate in the datasheet rather than assuming the configured value is exact.
TTL-level UART vs RS-232
UART is a protocol, not a voltage standard. The two most common physical layers used with it are:
| TTL-level UART | RS-232 | |
|---|---|---|
| Logic high | 3.3 V or 5 V | −3 V to −15 V |
| Logic low | 0 V | +3 V to +15 V |
| Logic polarity | Non-inverted | Inverted |
| Practical cable length | < 1 m (PCB to PCB) | Up to ~15 m at 9600 baud |
| Typical connector | Header pins, JST | DB9 or DB25 |
RS-232 inverts the logic levels relative to TTL — logic 1 is a negative voltage, logic 0 is positive — and uses higher voltages to tolerate cable noise and length. A USB-to-serial adapter presents TTL-level UART internally. Connecting it directly to a DB9 RS-232 port without level conversion produces no communication and can damage an unprotected MCU input. A level-translating IC such as the MAX3232 (for 3.3 V systems) or MAX232 (for 5 V systems) converts between the two voltage standards.
When UART is the right choice
| Use case | Why UART suits it |
|---|---|
| Debug console / printf output | One wire per direction, trivial to read with a USB-serial adapter |
| GPS receiver, Bluetooth module, GSM modem | Most serial modules expose a standard TTL UART interface |
| MCU-to-MCU point-to-point link | Simpler than SPI with fewer wires; no addressing overhead of I2C |
| Long cable runs (with RS-232 or RS-485) | SPI and I2C are not designed to drive off-board |
| MCU ROM bootloader | STM32's built-in system bootloader communicates over UART |
UART is not a good fit when you need to talk to multiple devices from a single port (use I2C or SPI), or when you need very high throughput to a single device at short distances (SPI at tens of MHz will outperform UART's practical ceiling of 1–4 Mbaud).
Practical Examples
A GPS module outputs NMEA sentences at 9600 baud over a single TX line. The microcontroller configures its UART in receive-only mode and reads sentences via an RX interrupt into a ring buffer, which the main loop drains when a complete sentence arrives (terminated by \r\n). The MCU never needs to transmit back, so only a single wire is used.
An ESP32 AT-command Wi-Fi module exposes a full-duplex UART interface. The host MCU sends AT+CWJAP="ssid","pass"\r\n and waits for an OK response. Both TX and RX are required, and hardware flow control (RTS/CTS) is typically enabled to prevent the module from overrunning the host receive buffer during long HTTP responses.
Design Considerations
- Verify baud rate accuracy: check the actual baud rate your MCU generates at its peripheral clock frequency. Most HAL and LL drivers report the fractional divisor error — confirm it stays within ±2% of the target. Errors compound over a frame; 9600 baud tolerates larger errors than 921600.
- Pull up the RX pin: a floating RX input will interpret capacitive coupling as spurious data. Configure the UART RX GPIO with an internal pull-up, or add an external resistor. This matters most when the far end may not be connected at power-up.
- Interrupt-driven or DMA reception: polling the UART RX flag in a main loop drops bytes at any baud rate above roughly 9600 on a busy MCU. Use the RX interrupt to move bytes into a ring buffer, or configure DMA reception with a half/full-transfer interrupt for high-throughput links.
- Hardware flow control: for any link where the transmitter can send faster than the receiver's firmware can consume data — particularly module interfaces — enable RTS/CTS. This prevents receiver-buffer overruns that cause silent data loss.
- Choosing between UART, SPI, and I2C: UART suits point-to-point links with minimal wires; SPI suits fast single-device transfers; I2C suits multi-device low-speed buses. For a structured protocol-selection guide covering all three, see SPI vs I2C vs UART: which to use.
- UART on Raspberry Pi: the Pi's PL011 (UART0) and mini-UART (UART1) require device tree configuration — including managing the Bluetooth co-processor assignment to access the full hardware UART on GPIO 14/15. See Raspberry Pi GPIO Interfacing for the overlay setup and serial console disable steps.
- Production serial driver development: writing robust UART drivers with ring buffers, DMA, timeout handling, and error recovery for production hardware is part of the embedded firmware services Zeus Design's software team provides across STM32, ESP32, and other platforms.
Common Mistakes
- TX-to-TX wiring: UART requires a cross-connection — the transmitter's TX pin connects to the receiver's RX pin, and vice versa. Connecting TX-to-TX (or RX-to-RX) produces silence with no firmware-visible error.
- Baud rate mismatch: a stream of random garbage characters almost always means both ends are not configured to the same baud rate, data-bit count, parity, or stop bits. Verify all four parameters match before looking for anything else.
- Confusing RS-232 and TTL levels: plugging a 3.3 V MCU UART TX directly into a DB9 RS-232 input produces no communication and risks exceeding the MCU's input voltage ratings from the ±12 V RS-232 driver on the far end.
- Peripheral clock change invalidating baud rate: if the MCU's peripheral clock changes after UART initialisation — due to PLL reconfiguration or entry into a low-power clock mode — the baud rate divisor register becomes wrong and the effective baud rate silently shifts. Reinitialise the UART after any clock change.
Frequently Asked Questions
- What does 8N1 mean in UART settings?
- 8N1 is the most common UART configuration: 8 data bits, No parity, 1 stop bit. The four parameters that define a UART frame are always written in this order: data bits (5–9), parity (N for none, E for even, O for odd), and stop bits (1 or 2). Both ends must use identical settings — a mismatch causes the receiver to mis-sample bit boundaries, producing garbled data or silence.
- Can UART connect more than two devices?
- Not without extra hardware. Standard UART is strictly point-to-point — one TX drives one RX. To address multiple devices from one port you need a protocol with addressing (I2C) or chip-selects (SPI), or a UART-based multi-drop standard like RS-485 that adds differential signalling and bus arbitration.
References
Related Questions
What Is SPI (Serial Peripheral Interface)?
SPI is a synchronous full-duplex serial bus for connecting microcontrollers to peripherals at high speed. Learn how SCLK, MOSI, MISO, and CS work.
What Is I2C (Inter-Integrated Circuit)?
I2C is a two-wire serial bus for addressing multiple peripherals over shared SDA/SCL lines. Learn how addressing, speed grades, and pull-up resistors work.
SPI vs I2C vs UART: Which Protocol Should You Use?
SPI suits high-speed transfers, I2C minimises pins for multi-device buses, and UART suits point-to-point links. Learn which to choose for your embedded design.
What Is a Microcontroller (MCU)?
A microcontroller (MCU) combines a CPU, flash, RAM, and peripherals on one chip. Learn how MCUs work and how they differ from microprocessors and FPGAs.
What Is RS-232?
RS-232 uses ±3 V to ±15 V signalling for point-to-point serial runs up to 15 m. Learn how it differs from UART and when a level converter IC is required.
What Is RS-485?
RS-485 is a differential multi-drop bus for up to 32 nodes over ~1200 m cable runs. Learn how half-duplex wiring, termination, and Modbus RTU work.