It’s not the story of far history when hardware devices were connected to the system through thick cables and cumbersome connectors! Sometimes they were even required to screw into the CPU. Those hardware devices are used to communicate with other processing units through a UART. While USB might seem to replace all such connections still UARTs have not been surrogated completely.

Standing for Universal Asynchronous Receiver-Transmitter, UART is used in several studies and projects for connecting GPS modules, RFID card readers, and other modules to the microcontrollers.

Unlike SPI or I2C, it is not a communication protocol but a standalone IC- a physical circuit in the microcontroller. This amazing device boasts a host of advantages, which have not let it fade into oblivion.

With this article, Team InSemi throws light on UART’s importance, signal transmission steps, and other things. So let’s gear up.

UART Communication

In this communication, two different UART interact with each other using only two wires to transmit the data. UART at the transmitting part converts the parallel data from the controlling units into the serial form and then transmits it in serial to the receiving devices. The receiving UART then converts the serial data back to its parallel form so that the receiving device can process it accordingly.

The flow of data from one UART (transmitter) to the other (receiver) is as:

                                                                                                         Fig1. UARTs at transmitting and receiving units

The data is transmitted here asynchronously. This means there is no need for the clock signals to synchronize the output bits from the transmitter to the sampling bits of the receiver. In UART communications the transmission unit adds start & stop bits to the data packets under consideration. And these bits define the inception and closure of data, making the receiver cognize when to initiate the reading of those bits.

As soon as the receiver senses the start bit, then with a specific frequency, it starts assessing the incoming signals. The specific frequency, expressed in bits per second, with which the incoming signals are processed, is called Baud Rate. Both the UART must operate at the same or about the same Baud Rate.

The maximum permissible difference in the Baud Rates of both UART is 10%. Otherwise, the timings will get too far!

How UARTs work?

The transmitting UART receives the data from a data bus in parallel form. Getting this parallel data UART adds a start bit, a parity bit, and a stop bit to it. This creates discrete data packets. Subsequently, these data packets are output serially bit by bit at the Tx pin, as shown in Fig1.

In the same way, the receiving UART read those data packets, bit by bit, at its Rx pin. That receiving UART transforms the data packet back into the parallel form and removes all those added starts, parity, and stop bits. The parallel data is sent to the data bus on the receiving hardware.

Check the image for better clarity:

                                                                                                           Fig2. Data Transmission across two UART

The data packets developed or dissolved by the UARTs contain 1 start bit, 5-9 data bits (This depends on the UART), and 1 or 2 stop bits with an option of 1 parity bit.

Let’s also discuss these bits in detail-

1. Data Frame

The data frames contain the actual data that is being transferred across two UARTs. If a parity bit is also in use then the data frame can be 5 to 8 bits long. In the absence of parity bits, the data frame can be up to 9 bits long.

2. Parity Bits

Basically, parity defines the evenness or the oddness of a number. With the parity bit, the receiving UART is able to identify if some data has been changed during the transmission. There can be several reasons for morphed data like electromagnetic radiations, different baud rates, or long data transfers.

As the receiver goes through the data frame it first counts the number of bits with a value of 1 and checks whether the total is even or odd.

With this logic when the parity bit matches the data, the UART at that end concluded the data without error. But if the total is odd with ‘0’ parity, or even with ‘1’ parity then UART assesses that data has been changed within the transmission.

3. Start Bit

When there is no data transmission the UART transmission line is held at a high voltage level. To start the transmission the UART pulls the transmission line to the low voltage level for one clock cycle. When the receiving end assesses the transition from high to low voltage level it starts reading the data frame at the baud rate.

4. Stop Bit

To interpret the end of the data packet transmission, the transmitting UART transits the transmission line from low to high voltage level- for at least two-bit durations. This way the data transfer stops.

Steps of UART data transmission

With all the aforementioned information, we can easily conclude that data transmission across two UARTs occurs in five major steps:

  1. The data bus sends data in parallel form to the transmitting UART.
  2. The transmitting UART adds a start bit, a parity bit, and the stop bit to the data frame.
  3. The complete data packet is serially sent to the receiving UART, which in turn samples the data line at a pre-configured baud rate.
  4. The receiver filters the start, stop, and parity bit from the data frame.
  5. Receiving UART converts the serial data frame to parallel form and transfers it to the data bus on the receiving end

Importance & Advantages

Mastery of UART communication protocol is highly helpful in developing robust and high-quality products. Sending the complete data packet or full payload only with two wires with the perfect know-how ensures a flawless data transfer. UART is the most commonly used hardware communication protocol and this knowledge empowers the designers to get a highly flexible design for future needs.

UART are the easiest hardware for data transmission as only two wires are required. There is no need for clock signals and the facility of parity bit addition ensures error-free transmissions.

Use Cases

UARTs can be used in multiple applications and the important ones include:

1. Debugging

Early detection of system bugs holds great importance during design. Adding UART helps by capturing the message from the system.

2. Function Level Tracing

Logs are very important in manufacturing. It triggers an alert for operators regarding the functionalities around the manufacturing line.

3. Client Updates

Software updates are not only indispensable but also inevitable. Having dynamic hardware in compliance with changes is important and UART are great in this regard.

4. Verifications

Complete verification before the end usage helps deliver the best quality product to the clients and UART greatly helps in this regard.