Introduction to UART:
UART as many of us knows the full form of it. UART stands for “Universal Asynchronous Receiver Transmitter”
As obvious from the asynchronous there is no control of clock with a single master single slave communication. In place of clock signal it is controlled by a start bit, stop bit and an optional parity bit. The transmitting UART converts the parallel data to serial data and transmits it to the receiving UART. It’s a two wire communication with the ground of both the UARTS are being common.
How UART Works:
The UART transmits the data received from data bus that is sending the data from any other device like CPU, memory or any other microcontroller in a parallel form. The transmitting UART converts the parallel data to serial form and sends it to the receiving UART in the form of a packet. The Packet consist of
- Start Bit
- Data Bits or Data Frame
- Optional Parity Bit
- Stop Bits
The Start bit is usually at high voltage when data is not transmitting. When the transmitting UART starts the transmission of data it brings the transmission line from high to low. When the receiving UART detects the high to low voltage transition it starts reading the data at a predefined baud rate.
Data Bits or Data Frame
The data bits or the data frame is the actual data that needs to be transmitted. In case of UART its length varies from 5 to 9 bits depending upon the optional parity bit. The LSB is transmitted first in most cases. The receiving UART receives the data, removes the start, stop and optional parity bit and sends the data to required devices.
The Stop bit usually one or two bits turns the transmission line voltage from low to high for at least two bits duration.
Parity bit as defined above is an optional bit. The transmitting and receiving UART may be configured to even parity or odd parity. The even parity means that the total number of 1s will be in even numbers. Parity bit will also help if there is data corrupted up to 1 bit.