cancel
Showing results for 
Search instead for 
Did you mean: 

How to the change baud rate dynamically?

dreamcoder
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief II

Your code have primary trouble handle how many timer reloads occurs over first to last for example device send FF FF FE on USART ...

Too __HAL_TIM_SET_COUNTER(htim, 0); why

Read STM32 USART automatic baud rate detection AN4908

View solution in original post

2 REPLIES 2
MM..1
Chief II

Your code have primary trouble handle how many timer reloads occurs over first to last for example device send FF FF FE on USART ...

Too __HAL_TIM_SET_COUNTER(htim, 0); why

Read STM32 USART automatic baud rate detection AN4908

You can change the UART->BRR by clearing the UE (Uart Enable) bit first in UART-CR1, and then re-enable.

With some awareness of the uint16_t number space, the delta time is actually less complicated to compute than you're making it.

You'd perhaps use PWM Input Capture and filter/check based on normative baud rate expectations. Have patterns or pairs in your a stream you can recognize/verify.

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