UART: Data Corruption

When data is transmitted, it is subject to corruption. Sometimes, bits may not be transmitted properly due to noise or external causes. As such, error detection and error correction protocols are necessary when designing a communications system.

One such error detection protocol is called parity. Parity comes in two different types: even and odd. Even parity necessitates that an uncorrupted packet of data has an even amount of 1’s, whereas odd parity required an odd amount of 1’s. Since data can have any combination of 1’s and 0’s, a parity bit is used to ensure that the packet retains the correct parity. For example, if we wanted to transmit the bitstring 01101, we would append a 1 as a parity bit to ensure even parity (or a 0 to ensure odd parity). The resulting packet would be 011011 (or 011010 for odd parity). If you count the number of 1’s in the packet, you would count four 1’s, which is an even number (or three for the odd parity case), thus the packet is uncorrupted.