2025-10-22 3:07 AM - last edited on 2025-10-22 6:53 AM by Andrew Neil
Hello!
I'm using STM32F401 (Blackpill board).
I made an experiment like this.
I set my PC serial setup as 8n1 and UART6 serial setup as 8n2.
And started communication between my PC and UART6.
It was okay. Nothing went wrong. For both sides, tx and rx.
Before this experiment, I expected two things.
1. TX setup 8n2 and RX setup 8n1 will be okay. Because receiving side will detect start bit whatever the stopbit is .
2. How does MCU receive from UART? If it is set as 8n2, can it receive the things transmitted as 8n1?
I was not sure about 2nd problem. Can anyone teach me how STM32F401 receives UART things? I need to know whether the 2nd case is really vaild or not.
Thank you.
2025-10-22 6:27 AM
Why not set them to the same settings?
This is covered in the reference manual. It looks like the second stop bit doesn't have any checking associated with it and will receive correctly in this case.
2025-10-22 6:52 AM - edited 2025-10-22 8:06 AM
A stop bit is indistinguishable from a line idle condition.
So, as long as the line remains idle for at least the required number of "stop bit" periods, it doesn't matter.
This is standard UART behaviour - nothing specific to STM32.
https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter
PS:
See also this Serial Communication tutorial from Sparkfun. It illustrates how the stop bit state is the same as the line idle state:
PPS:
@LS813 wrote:Can anyone teach me how STM32F401 receives UART things?
A full description of the UART operation is in the Reference Manual - RM0383:
PPPS:
See also: https://electronics.stackexchange.com/a/544355
And: https://electronics.stackexchange.com/a/631284
#UARTStopBits #StopBits