STM32F446 UART: Reading received 9th bit (i.e. DR[8]) in USART_DR when PCE=0 and M=1 in USART_CR1
I want to interface to an existing RS-485 bus where the 9th bit (normally reserved for parity) is set to 1 for the first two packets of each frame (as an addressing mechanism) and then cleared to 0 for the subsequent "data" bytes.
If I set PCE=0 in register USART_CR1, that will disable parity generation (on TX) and checking (on RX), which is what I want.
Since I need 9 bits of data (in addition to the start and stop bits), I also need to set M=1 in register USART_CR1
So far so good.
When transmitting, I should be able to load all 9 bits into DR[8:0] in USART_DR and they will be transmitted as-written by my code.
But on reception, I am not sure (from the Reference Manual https://www.st.com/resource/en/reference_manual/dm00135183-stm32f446xx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf)
It says the following (in section 25.6.2 on PDF page 838)
"When transmitting with the parity enabled (PCE bit set to 1 in the USART_CR1 register), the
value written in the MSB (bit 7 or bit 8 depending on the data length) has no effect because
it is replaced by the parity.
When receiving with the parity enabled, the value read in the MSB bit is the received parity
bit."
So I am assuming, though it isn't stated, that DR[8] will contain the actual 9th bit that was received.
Is this correct? I just want to be 100% sure before I place an order for a Nucleo board!!!
