serial communication protocol - UART

UART – What is it and How to use?

Background:

Serial communication (such as UART, SPI and other protocols) is widely used in modern applications because of its practicality over parallel. In serial communications, the data stored within a computer in clusters of bits, either bytes (8 bits at a time) or words (8/16/32 bits at a time), is decomposed into its individual bits before being transmitted one bit at a time to another computer. In serial data transmission the data is sent 1 bit at a time from a parallel in/serial out shift register to a serial in/parallel out shift register.

At its simplest, it is like:

Serial communication such as UART - simple diagram
  • TX: Transmit line.
  • RX: Receive line
  • GND: Common ground.

Outline:

  1. UART.
  2. Pros and Cons of UART.
  3. UART data format.
  4. Conclusion.

UART:

UART transmitting and receiving protocol diagram

UART has one connection in each direction + common Gound. Meaning, it is often called “2-wire serial”. And, it is most used for “low volume transmissions”.

Key info: “UART is a 2-wires protocol (send, receive and ground)”

Pros and Cons of UART:

Pros:

  • UART is easy to implement, hardware is not complex.
  • Widely used, many applications use it.

Cons:

  • UART is inefficient as it requires min of 2 extra bits to be transmitted with every 8-bits of data.
  • Only 2 devices can be connected using UART to communicate.

UART data format:

  1. Transmitter:

Shift the parallel data onto the serial line using the transmitter’s clock and adds start, end and parity bits.

Start bit (1 bit)Data bits (5-8 bits)Parity (1 bit)Stop bit (1-2 bits)
  • Start bit: Indicates the beginning of the data word.
  • Data bits: The actual data to be transmitted.
  • Parity but (optional): For error correcting (Even or Odd).
  • Stop bit: Indicates the end of the data word.

NB: Baud rate (number of symbols per second) must be defined at the same rate beforehand in the transmitter and receiver.

  1. Receiver:

Extracts the data using its own clock and converts the serial data back to the parallel form after stripping off the start, stop and parity bits.

Receiving format in UART serial communication protocol

Most UARTs uses 16 x Clock cycle. Take a sample at every 16 x Clock tick. Therefore, incoming signal must be around 16 times slower than the clock.

Key info: “Want something robust, bulletproof and everyone uses? Use UART”

Conclusion:

  1. Serial communication is widely used in modern applications because of its practicality over parallel.
  2. UART is a 2-wires protocol – send, receive and ground.
  3. It is easy to implement but inefficient as it requires min of 2 extra bits to be transmitted with every 8-bits of data.
  4. Only 2 devices can be connected using UART.
  5. UART data format: start bit, data bit, parity bit(s) and stop bit.
  6. Receiver uses its own clock to pick up data from the receive line.
  7. UART is robust, bulletproof and everyone uses.

Leave a Comment

Your email address will not be published. Required fields are marked *