What is UART?
• Universal asynchronous receiver / transmitter
• Protocol for exchanging serial data between
two devices
TX
TX
• Uses only two wires
- TX to RX (each direction)
• Can be simplex, half-duplex, or full-duplex
Where is UART used?
• UART was one of the earliest serial protocols
Serial (COM) ports, RS-232, modems, etc.
• Popularity of UART is however decreasing:
- SPI and 12C between components
- Ethernet and USB between computers and
peripherals
• Still important for lower-speed, low-throughput
applications
About timing / synchronization
• UART is asynchronous – the transmitter and
receiver do not share a common clock
Common UART
baud rates
• The transmitter and receiver therefore must:
Transmit at the same (known) speed
- Use the same frame structure / parameters.
UART frame format:
- UART frames consist of:
- Start / stop bits
- - Data bits
- Parity bit (optional)
- • High voltage ("mark") = 1, low voltage ("space") = 0
Data bit :
• User (useful) data
• Length: 5 to 9 bits (usually 7 or 8)
• Data is typically sent with the least
significant bit (LSB) first.
Parity bit (optional)
• Used for error detection
• Example:
ASCII 'S' (0x52 = 1010011) four 1's
- If even parity, parity bit is 0 (because
number of 1's already even)
• Even parity: number of 1's must be even
• Odd parity : number of 1's must be odd
- If odd parity, parity bit is 1 (to make the
Summary
• UART = universal asynchronous receiver / transmitter
Simple, two-wire protocol for exchanging serial data
No shared clock – baud rate must be configured the
same on both sides
Start / stop bits used to frame user data
Optional parity bit for detecting single-bit errors
• Widely used serial data protocol, but slowly being
replaced by SPI, 12C, USB and Ethernet.
Nice explanation
ReplyDelete