UART Communication

Dharmik Gohel
Analytics Vidhya

--

Hello Guys and Gals,

I have came back with another interesting topic name as UART Communication it is one of the most popular communication interfaces that has great significance in IoT security and penetration testing.

So let’s understand what is UART and why UART?

There are two ways in which components exchange data

  1. Serial Communication
  2. Parallel Communication

Serial Communication:-Serial communication is used to transfer one bit at a time through a given medium.

Serial Communication

Parallel Commutation:-In Parallel communication, a block of data is transferred at the same time with each of the bits requiring a separate channel (and additionally a reference line — typically ground). Because parallel communication transfers a huge chunk of data at a time, this method requires several separate lines to facilitate the communication. As you can imagine, this would result in the requirement for more real estate on the board, which is often not preferred.

Parallel Communication

UART is an asynchronous serial communication protocol used in many embedded and IoT devices. Asynchronous simply means that unlike a synchronous protocol, it does not have a clock that syncs for both the devices between which the communication taking place.

The data in the case of UART would be transferred without the need for an additional line of external clock (CLK). This is also why many other precautions are taken while transferring data asynchronously between devices over serial to minimize packet loss.

UART Data Packet

UART data packet consist of several components

  1. Starting Bit
  2. Message
  3. Parity Bit
  4. Stop Bit
UART Data Structure
  1. Starting Bit:-The starting bit symbolizes that the UART data is going to be next. This is usually a low pulse (0) that you can view in the logic analyzer.
  2. Message:- The actual message that is to be transferred as an 8-bit format. For example, if I have to transmit the value A (with the value 0x41 in hex) it would be transferred as 0, 1, 0, 0, 0, 0, 0, and 1 in the message.
  3. Parity bit:-The parity bit is not that relevant in real-life scenarios, as I have not seen a lot of devices using it. A parity bit is used to perform error and data corruption checking by counting the number of high or low values in the message, and based on whether it’s an odd parity or an even parity, it would indicate that the data are not correct. Remember that the parity bit is only used for data corruption checking and validation, and not actual correction.
  4. Stop bit:-The final bit that symbolizes that the message has now completed transmission. This is usually done by a high pulse (1), but could also be done by more than one high pulse, depending on the configuration the device developer uses.

After understanding how UART data structure work we will understand about UART Ports which are sometime hardware based or software based to give a good example we will look at Atmel’s micro controllers AT89S52 and ATMEGA328 have just one hardware serial port. If it is required, a user is free to emulate more software UART ports on specific general purpose input/output (GPIOs).

That’s all folks hope you understand the concept behind the UART communication feel free to comment below. I hope you have learned something today.

In next and upcoming topic we will discuss about BAUD rate and connections about UART exploitation.

Thank you

Have a nice day

--

--