cancel
Showing results for 
Search instead for 
Did you mean: 

Can I change UART baud rate in run time?

dubanoze
Associate
Posted on June 30, 2016 at 20:51

Hello.

STM32L1. 

I need change baud rate from 9600 to 115200 on run time.

Which sequence?

Now:

1) Init port on 9600.

2) Send command to GPS module for baud rate change to 115200.

3) Reinit port on 115200.

4) Overrun error receive and go to HAL_UART_ErrorCallback.

Please, help.

#no-hablo-hal #stm32-uart
1 REPLY 1
Posted on June 30, 2016 at 21:28

I don't use HAL, you're on your own there.

Yes, you can change baud rate, it is important to make sure that any transmitting data has cleared out the buffer first, ie TXE and TC both asserted.

It is possible you might have to clear framing errors, not sure overruns would be an issue.

I've done this with u-blox parts...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..