STM32 gotchas
12. UART parity bit missing

Users find it surprising, that they set UART to N data bit plus a certain (odd or even) parity, but the UART transmits (and receives, too, although that's not that conspicuous) only N bits altogether... so the parity bit is missing, right?

Reason for this is, that the set number of bits includes the parity bit. In other words, if parity is set, the highermost (latest transmitted) bit is not taken from the data register (DR or TDR), but is replaced by the calculated parity. Similarly, in the received frame, the last bit is not stored to the data register (DR/RDR), rather, it's checked against the parity calculated from previously received bits.

This is different from most other UARTS out there, where the parity bit is appended to whatever number of data bits is set. This is why it is surprising, even if clearly documented in the USART/UART chapter of RM.

As the older STM32 UARTs are limited to 8 or 9 bits (and the newer ones to 7, 8 or 9), this also means, that when parity is used, the maximum number of data bits is 8.