RM0016 Universal asynchronous receiver transmitter (UART)
Doc ID 14587 Rev 8 323/449
Table 56. UART receiver’s tolerance when UART_DIV[3:0] is different from zero
Note: The values specified in Tab le 5 5 and Tabl e 5 6 may slightly differ in the special case when
the received frames contain some Idle frames of exactly 10-bit times when M=0 (11-bit times
when M=1).
22.3.6 Parity control
Parity control (generation of parity bit in transmission and parity checking in reception) can
be enabled by setting the PCEN bit in the UART_CR1 register. Depending on the frame
length defined by the M bit, the possible UART frame formats are as listed in Ta bl e 5 7.
Legends: SB: Start Bit, STB: Stop Bit, PB: Parity Bit
Note: In case of wakeup by an address mark, the MSB bit of the data is taken into account and not
the parity bit
Even parity: the parity bit is calculated to obtain an even number of “1s” inside the frame
made of the 7 or 8 LSB bits (depending on whether M is equal to 0 or 1) and the parity bit.
Ex: data=00110101; 4 bits set => parity bit will be 0 if even parity is selected (PS bit in
UART_CR1 = 0).
Odd parity: the parity bit is calculated to obtain an odd number of “1s” inside the frame
made of the 7 or 8 LSB bits (depending on whether M is equal to 0 or 1) and the parity bit.
Example: data=00110101; 4 bits set => parity bit will be 1 if odd parity is selected (PS bit in
UART_CR1 = 1).
Transmission: If the PCEN bit is set in UART_CR1 then the MSB bit of the data written in
the data register is not transmitted but is changed by the parity bit to give an even number of
‘1’s if even parity is selected (PS=0) or an odd number of ‘1’s if odd parity is selected
(PS=1).
Reception: If the parity check fails, the PE flag is set in the UART_SR register and an
interrupt is generated if the PIEN bit is set in the UART_CR1 register.
M bit NF is an error NF is don’t care
0 3.33% 3.88%
1 3.03% 3.53%
Table 57. Frame format
M bit PCEN bit UART frame
0 0 | SB | 8 bit data | STB |
0 1 | SB | 7-bit data | PB | STB |
1 0 | SB | 9-bit data | STB |
1 1 | SB | 8-bit data PB | STB |