UART

Universal Asynchronous Receiver Transmitter(UART) is a serial communication protocol. Devices with UART often have a register to control the baud rate. UART also has a synchronous version called USART. In USART, both the devices that are communicating have a shared clock. The frequency of the clock is used to determine sampling of bits.

UART only has two lines -

  • TX for transmission
  • RX for reception
  • USART has one additional clock line

Working

Dataframe

A single frame of data in UART consists of

  • A start bit (0)
  • The data itself. Is usually 8 bits
  • Sometimes parity bits
  • A stop bit (1)

Libraries and utils

pyserial

With the use of the pyserial library, we can specify a port and baud rate; after which we can send and receive data serially.