29.4.3.1 Parity

Parity can be enabled for error checking by writing USART_FRAME_WITH_PARITY to the Frame Format bit field in the Control A register (CTRLA.FORM). Even parity is selected by writing the Parity mode bit in the Control B register (CTRLB.PMODE) to ‘0’. Odd parity is selected by writing CTRLB.PMODE to ‘1’.

If even parity is selected, the parity bit of an outgoing frame is ‘1’ if the data contains an odd number of bits that are ‘1’, making the total number of ‘1’ even.

If odd parity is selected, the parity bit of an outgoing frame is ‘1’ if the data contains an even number of bits that are ‘1’, making the total number of ‘1’ odd.

When parity checking is enabled, the parity checker calculates the parity of the data bits in incoming frames and compares the result with the parity bit of the corresponding frame. If a parity error is detected, the Parity Error bit in the Status register (STATUS.PERR) is set.