Basics of UART Communication (2024)

UART or Universal Asynchronous Receiver Transmitter is a dedicated hardware associated with serial communication. The hardware for UART can be a circuit integrated on the microcontroller or a dedicated IC. This is contrast to SPI or I2C, which are just communication protocols.

Outline

Basics of UART Communication

UART is one of the most simple and most commonly used Serial Communication techniques. Today, UART is being used in many applications like GPS Receivers, Bluetooth Modules, GSM and GPRS Modems, Wireless Communication Systems, RFID based applications etc.

If you remember older computer systems, devices like Mouse, Printer and Modem are connected using a heavy connectors at the back. All these devices communicated using UART.

Even though USB has replaced all types of communication standards on computers and other devices, UART is still being used in the above mentioned applications.

Almost all microcontrollers have dedicated UART hardware built in to their architecture. The main reason for integrating the UART hardware in to microcontrollers is that it is a serial communication and requires only two wires for communication.

Before going in to further explanation of UART, how it works and steps involved in transmission and reception of data, we will try to recollect some information about Serial Communication and a small comparison between serial and parallel communications.

Brief Note on Parallel and Serial Communication

Transfer of Digital Data from one device to another can be achieved in two ways: Parallel Data Transfer and Serial Data Transfer. In parallel data transfer, all the bits are transferred from the source to destination at once.

This is possible because parallel data transfer uses multiple lanes or wires between the transmitter and receiver in order to transfer the data.

Parallel Data Transfer methods are faster and expensive as they needs more hardware and a lot of wires. Olden day’s printers are the best example for external parallel communication. Other examples are RAM, PCI, etc.

With the progress in integrated circuit technology, the digital IC’s are becoming smaller and faster and as a result the transfer rates in Parallel Communication with multiple lanes have reached a bottle neck.

Serial Communication on the hand, transfers data bit by bit using a single line or wire. For two way communication between the transmitter and receiver, we need just two wires for successful serial data transfer.

Since serial communication needs less circuitry and wires, the cost of implementing is less. As a result, using serial communication in complex circuitry might be more practical than parallel communication.


But the only concern with serial data transfers is speed. Since the data transfer occurs over a single line, the speed of transfer in serial communication is less than that of parallel communication. Now – a – days, the speed of serial data transfer isn’t a concern as advancements in technology have led to faster transfer speeds.

Introduction to UART Communication

UART or Universal Asynchronous Receiver Transmitter is a serial communication device that performs parallel – to – serial data conversion at the transmitter side and serial – to – parallel data conversion at the receiver side. It is universal because the parameters like transfer speed, data speed, etc. are configurable.

As mentioned in the introduction section, UART is a piece of hardware that acts as a bridge between the processor and the serial communication protocol or port. The following image shows this interface briefly. The serial communication can be anything like USB, RS – 232, etc.


The letter ‘A’ in UART stands for Asynchronous i.e. there is no clock signal to synchronize or validate the data transmitted from transmitter and received by the receiver (Asynchronous Serial Communication).

This is in contrast to Synchronous Serial Communication, which uses a clock signal that is shared between the transmitter and receiver in order to “Synchronize” the data between them.

If there is no clock (or any other timing signal) between the transmitter and receiver, then how does the receiver know when to read the data?

In UART, the transmitter and receiver must agree on timing parameters beforehand. Also, UART uses special bits at the beginning and ending of each data word to synchronize the transmitter and receiver. More about these special bits in the later sections.

In UART based Serial Communication, the transmitter and receiver communicate in the following manner. The UART on the sender device i.e. the transmitting UART receives parallel data from the CPU (microprocessor or microcontroller) and converts it in to serial data.

This serial data is transmitted to the UART on the receiver device i.e. receiving UART. The receiving UART, upon receiving the serial data, converts it back to parallel data and gives it to the CPU.

The pin on the transmitting UART, which transmits the serial data is called TX and the pin on the receiving UART, which receives the serial data is called RX.

Since the UART involves parallel – to – serial and serial – to – parallel data conversion, shift registers are an essential part of the UART hardware (two shift registers to be specific: Transmitter Shift Register and Receiver Shift Register).

How UART Works?

In UART Serial Communication, the data is transmitted asynchronously i.e. there is no clock or other timing signal involved between the sender and receiver. Instead of clock signal, UART uses some special bits called Start and Stop bits.

These bits are added to the actual data packet at the beginning and end respectively. These additional bits allows the receiving UART to identify the actual data.

The image above shows a typical UART connection. The transmitting UART receives data from the controlling device through the data bus. The controlling device can be anything like a CPU of a microprocessor or a microcontroller, memory unit like a RAM or ROM, etc. The data received by the transmitting UART from the data bus is parallel data.

To this data, the UART adds Start, Parity and Stop bits in order to convert it into a data packet. The data packet is then converted from parallel to serial with the help of shift register and is transmitted bit – by – bit from the TX pin.

The receiving UART receives this serial data at the RX pin and detects the actual data by identifying the start and stop bits. Parity bit is used to check the integrity of the data.

Up on separating the start, parity and stop bits from the data packet, the data is converted to parallel data with the help of shift register. This parallel data is sent to the controller at the receiving end through a data bus.

Structure of Data Packet or Frame

The data in UART serial communication is organised in to blocks called Packets or Frames. The structure of a typical UART Data Packet or the standard framing of the data is shown in the following image.

Let us see about each piece of the frame.

Start Bit: Start bit is a synchronisation bit that is added before the actual data. Start bit marks the beginning of the data packet. Usually, an idle data line i.e. when the data transmission line is not transmitting any data, it is held at a high voltage level (1).

In order to start the data transfer, the transmitting UART pulls the data line from high voltage level to low voltage level (from 1 to 0). The receiving UART detects this change from high to low on the data line and begins reading the actual data. Usually, there is only one start bit.

Stop Bit: The Stop Bit, as the name suggests, marks the end of the data packet. It is usually two bits long but often only on bit is used. In order to end the transmission, the UART maintains the data line at high voltage (1).

Parity Bit: Parity allows the receiver to check whether the received data is correct or not. Parity is a low – level error checking system and comes in two varieties: Even Parity and Odd Parity. Parity bit is optional and it is actually not that widely used.

Data Bits: Data bits are the actual data being transmitted from sender to receiver. The length of the data frame can be anywhere between 5 and 9 (9 bits if parity is not used and only 8 bits if parity is used). Usually, the LSB is the first bit of data to be transmitted (unless otherwise specified).

Rules of UART

As mentioned earlier, there is no clock signal in UART and the transmitter and receiver must agree on some rules of serial communication for error free transfer of data. The rules include:

  • Synchronisation Bits (Start and Stop bits)
  • Parity Bit
  • Data Bits and
  • Baud Rate

We have seen about synchronisation bits, parity bit and data bits. Another important parameter is the Baud Rate.

Baud Rate: The speed at which the data is transmitted is mentioned using Baud Rate. Both the transmitting UART and Receiving UART must agree on the Baud Rate for a successful data transmission.

Baud Rate is measured in bits per second. Some of the standard baud rates are 4800 bps, 9600 bps, 19200 bps, 115200 bps etc. Out of these 9600 bps baud rate is the most commonly used one.

Let us see an example data frame where two blocks of data i.e. 00101101 and 11010011 must be transmitted. The format of the frame is 9600 8N1 i.e. 9600 bps with 8 bits of data, no parity and 1 stop bit. In this example, we haven’t used the parity bit.


Advantages of UART

  • Requires only two wires for full duplex data transmission (apart from the power lines).
  • No need for clock or any other timing signal.
  • Parity bit ensures basic error checking is integrated in to the data packet frame.

Disadvantages of UART

  • Size of the data in the frame is limited.
  • Speed for data transfer is less compared to parallel communication.
  • Transmitter and receiver must agree to the rules of transmission and appropriate baud rate must be selected.

Related Posts:

  • Arduino Serial Communication
  • HC-05 Bluetooth Module - Tutorial, Arduino Interface
  • Interfacing HC-05 Bluetooth with STM32F103C8T6 |…
  • Basic ARM7 (LPC2148) Tutorials For Beginners
  • How To Connect Arduino Uno To Android via Bluetooth
  • Basics of Serial Peripheral Interface (SPI)
Basics of UART Communication (2024)

FAQs

How does UART communication work? ›

In UART communication, two UARTs communicate directly with each other. The transmitting UART converts parallel data from a controlling device like a CPU into serial form, transmits it in serial to the receiving UART, which then converts the serial data back into parallel data for the receiving device.

What is UART for dummies? ›

What is UART? UART stands for universal asynchronous receiver / transmitter and defines a protocol, or set of rules, for exchanging serial data between two devices.

What is the basic of serial communication? ›

What is serial communication? Serial communication is a communication method that uses one or two transmission lines to send and receive data, and that data is continuously sent and received one bit at a time.

What is the most common UART communication mode? ›

Asynchronous mode is the most common mode and is used for standard UART communication. Synchronous mode is used for higher-speed communication and requires a clock signal. ISO7816 mode is used for communication with smart cards and supports features such as parity checking and error detection.

What is a real life example of UART? ›

A practical example of UART communication involves connecting a microcontroller to a computer. Consider a scenario where a temperature sensor is connected to a microcontroller, and the microcontroller sends the temperature readings to a computer for display.

Is UART synchronous or asynchronous? ›

By definition, UART is a hardware communication protocol that uses asynchronous serial communication with configurable speed. Asynchronous means there is no clock signal to synchronize the output bits from the transmitting device going to the receiving end.

Is UART outdated? ›

UART is considered to be one of the earliest communication interfaces applied to computers. The newer USB protocol, however, has replaced many UART systems, but both are still prevalent in the embedded industry.

How to read data from UART? ›

The Serial Receive block reads data from the Universal Asynchronous Receiver Transmitter (UART) port on the board. To select the UART port, use the UART parameter. The block reads the values from the UART port, using the Rx (receiving) pin on the port.

Is UART serial or parallel? ›

A universal asynchronous receiver-transmitter (UART /ˈjuːɑːrt/) is a peripheral device for asynchronous serial communication in which the data format and transmission speeds are configurable.

What are the 2 types of serial communication? ›

There are two broad types of serial communication: synchronous and asynchronous. There are a very large number of different standards and protocols for serial communication, ranging from the very simple to the seriously complicated. It is important to match the right protocol with the right application.

What are the three protocols of serial communication? ›

Key Takeaways
Common Serial Communication Protocols
ProtocolStands for
UARTUniversal Asynchronous Receiver-Transmitter
USARTUniversal Synchronous/Asynchronous Receiver-Transmitter
SPISerial Peripheral Interface
8 more rows
Mar 11, 2024

What are the common baud rates for UART? ›

The standard baud rates are the following: 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600. It is important to have the same baud rate configured on each side of the communication.

How to communicate with UART? ›

As a kind of asynchronous serial communication protocol, UART works by transmitting each binary bit of the transmitted data bit by bit. In the UART communication protocol, when the state on the signal line is high, it represents '1', and when the state on the signal line is low, it represents '0'.

How far can UART transmit? ›

UART has a max communication distance of 15 meters. UART leverages shift registers to convert serial communication to parallel communication. UART is commonly used as a “serial port” on computers or in microcontrollers. UART supports full-duplex communication.

How to check UART communication? ›

You can use a terminal program to test your UART communication and see if the data is correct and consistent. Some examples of terminal programs are PuTTY, Tera Term, or Arduino Serial Monitor. To use a terminal program, you need a USB-to-serial converter that connects your microcontroller to your computer's USB port.

How does UART over USB work? ›

The USB-to- UART bridge acts like a translator between the two interfaces to allow a device to send/receive information on one interface and receive/send the information on the other interface.

Can UART transmit and receive at the same time? ›

The UART is full-duplex - this means that it can both send and receive at the same time. The hardware for sending is separate from the hardware for receiving - so they can operate in parallel.

How is data detected in an UART? ›

How is data detected in a UART? Explanation: The data can be detected by the local clock reference which is generated from the baud rate generator.

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Corie Satterfield

Last Updated:

Views: 5534

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Corie Satterfield

Birthday: 1992-08-19

Address: 850 Benjamin Bridge, Dickinsonchester, CO 68572-0542

Phone: +26813599986666

Job: Sales Manager

Hobby: Table tennis, Soapmaking, Flower arranging, amateur radio, Rock climbing, scrapbook, Horseback riding

Introduction: My name is Corie Satterfield, I am a fancy, perfect, spotless, quaint, fantastic, funny, lucky person who loves writing and wants to share my knowledge and understanding with you.