
Universal synchronous asynchronous receiver transmitter (USART)
RM0008
776/1096
Doc ID 13902 Rev 12
Figure 284. Mute mode using Address mark detection
27.3.7 Parity
control
Parity control (generation of parity bit in transmission and parity checking in reception) can
be enabled by setting the PCE bit in the USART_CR1 register. Depending on the frame
length defined by the M bit, the possible USART frame formats are as listed in
.
Note:
In case of wake up 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
USART_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.
Ex: data=00110101; 4 bits set => parity bit will be 1 if odd parity is selected (PS bit in
USART_CR1 = 1).
Transmission mode:
If the PCE bit is set in USART_CR1, then the MSB bit of the data
written in the data register is transmitted but is changed by the parity bit (even number of
“1s” if even parity is selected (PS=0) or an odd number of “1s” if odd parity is selected
(PS=1)). If the parity check fails, the PE flag is set in the USART_SR register and an
interrupt is generated if PEIE is set in the USART_CR1 register.
RWU written to 1
IDLE
RX
Addr=0
RWU
Mute Mode
Normal Mode
Matching address
RXNE
RXNE
(RXNE was cleared)
Data 2
Data 3
Data 4
Data 5
Data 1
IDLE
Addr=1
Addr=2
Mute Mode
In this example, the current address of the receiver is 1
(programmed in the USART_CR2 register)
Non-matching address
Non-matching address
Table 194.
Frame formats
(1)
1.
Legends: SB: Start Bit, STB: Stop Bit, PB: Parity Bit
M bit
PCE bit
USART 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 |