Skip to main content
LS813
Associate
October 22, 2025
Solved

STM32F401: UART 'Stop Bits' Setting

  • October 22, 2025
  • 2 replies
  • 285 views

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.

Best answer by Andrew Neil

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:

 

AndrewNeil_1-1761141505017.png

 

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:

AndrewNeil_0-1761141912841.png

 

PPPS:

See also: https://electronics.stackexchange.com/a/544355

And: https://electronics.stackexchange.com/a/631284

 

#UARTStopBits #StopBits

2 replies

TDK
Super User
October 22, 2025

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.

TDK_0-1761139647016.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
LS813
LS813Author
Associate
October 23, 2025

Thank you very much.

Andrew Neil
Andrew NeilBest answer
Super User
October 22, 2025

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:

 

AndrewNeil_1-1761141505017.png

 

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:

AndrewNeil_0-1761141912841.png

 

PPPS:

See also: https://electronics.stackexchange.com/a/544355

And: https://electronics.stackexchange.com/a/631284

 

#UARTStopBits #StopBits

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.