What is UART? Basics of UART

What is UART?

Universal Asynchronous Receiver / Transmitter (UART) is a serial communication method that allows two different device components to talk to each other without a clock.

UART is mostly used in IoT security. There is also known as Universal Synchronous/ Asynchronous Receiver/Transmitter (USART), which transmits data both synchronously and asynchronously depending on the requirement.

How UART works?

The UART which will transmit data will receive data from a network bus. The data bus is used by another computer such as a CPU, memory, or microcontroller to send data to the UART. Data is passed in parallel fashion from the data bus to the UART transmitter.

After UART transmits the parallel data from the network bus, the data packet is generated by inserting a start bit, a parity bit, and a stop bit. First, the Tx pin outputs the data packet serially, bit by bit. The receiving UART at its Rx pin reads the data packet bit by bit.

Then the receiving UART transforms the data back into parallel form, eliminating the start bit, parity bit, and stop bits. The receiving UART eventually passes the data packet parallel to the receiving end of the data bus:

Why to use UART?

UART is an asynchronous serial communication protocol used in many embedded devices and IoT devices, as described above. Asynchronous simply means that, unlike a synchronous protocol (e.g., SPI), there is no clock synchronizing the two devices between which the interaction takes place.

The data would be transferred in the case of UART without needing an additional external clock row (CLK). This is also why many other precautions are taken to reduce packet loss when transmitting data asynchronously between devices over serial.

UART Data Packet:

A UART data packet consists of several components.

Starting bit: The starting bit symbolizes the next UART data. Normally this is a small pulse (0) you can see in the logic analyzer

Message: the actual message to be sent as an 8-bit file. For eg, if I have to transmit the value A (with 0x41 in hex) it would be transmitted in the text as 0, 1, 0, 0, 0, 0, 0, 0, and 1

Parity bit: A parity bit is used to test error and data corruption by counting the number of high or low values in the text, and it would mean that the data is not correct based on whether it is an odd parity or even a parity.

Stop bit: the final bit symbolizing the transmission of the message now completed. Typically this is achieved by a high pulse (1), but also by more than one high pulse, depending on the configuration used by the system manufacturer.

Type of UART Ports:

A UART port may be based either on hardware or software. To give you an example, Atmel’s AT89S52 and ATMEGA328 microcontrollers only have one serial hardware port.

On the other hand, microcontrollers such as LPC1768 and ATMEGA2560 have several UART hardware ports, all of which can be used to conduct UART-based research and use.

Software-based UARTs are needed if multiple devices need to be connected via UART to a system with limited sets of UART pins hardware. This also gives the user the flexibility to use the GPIO pins as UART if needed and use it at a later point in time for another purpose.

Advantages of UART:

  • No clock signal
  • Has a parity bit for correcting errors
  • The data packet structure can be modified as long as both sides are optimized for it.
  • Only two wires are used.

Disadvantages of UART:

  • The data frame size is limited to no more than 9 bits
  • Does not support multiple master systems or slaves
  • Every UART’s baud rates must be within 10 percent.


Instrumentation Engineer

Related Articles

Back to top button