Understanding the frame format of a UART signal

This is how UART transmitted data is organized: It is organized into packets that have one start bit, 5 to 9 data bits. A parity bit is optional, and 2 stop bits.

Start Bit: When not transmitting data the UART data transmission line is usually high voltage. In order to start the transfer process the transmitting UART switches from high voltage to low voltage for one clock cycle. The receiving UART will detect the high to low voltage transition and start reading the bits at the accurate baud rate. Note many of the serial line drivers reverse the polarity as they are inverting.

Parity: Parity is the oddness or evenness of a number. The parity bit functions to tell the receiving UART if the data has changed during transmission. Bits can change due to electromagnetism, different baud rates or long-distance transmission of data. The UART reads the data frame after receiving the data. It then counts the number of bits and checks if they are even or odd. If the parity bit is a 0 then it is even parity. If the bit is a 1 then it is an odd parity. For the UART to know that the transmission is free of errors the parity bit has to match the data. You can also transmit without the parity bit.

Stop bits: For at least two-bit duration the transmitting UART drives the transmission line from a low to a high voltage. I always sent with two stops bits and received with 1, this gave me one extra bit time to minimize data skewing.

Baud Rate: The communication between two devices via UART Protocol occurs by transmission of bits. A total of 8 bits are sent one right after the other to transmit a byte. A bit is either a logical low or high. The time interval between two bits is called the baud rate or bit rate. The baud rate must be defined in both transmit and receive devices. This allows the sending device to encode the data into bit pattern with the specific time interval. There is an allowable tolerance in the baud clock. Note the faster the baud the narrow the time tolerance becomes. It is important that the receiver gets the successive bits at the right time.

The most commonly used baud rates is 9600 bits per second. Although other baud rates are also used, but the higher the bit rate, the more chances there are of data corruption. Lower bit rates are used when there is greater physical distance between two devices because the length of the wire increases resistance and thus deteriorates the signal.

9600 8N1 - 9600 baud, 8 data bits, no parity, and 1 stop bit - is one of the more commonly used serial protocols. This can be in a slightly different format but it indicates the same. For 1200 baud it would be 12 8N1.

image