cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H753 UART Baud is 15% low.

GlennH
Associate III

STM32H753 UART Baud is 15% low. I set it to 115200, but it's running at 98400. Is this a misconfigured clock?

25 REPLIES 25

Why do you say they look cube-generated? There are no MX_ functions called, just HAL.

Because of the comments and other style hints.

Where is your ClockPrescaler value?

	    huart6.Instance                    = USART6;
	    huart6.Init.BaudRate               = 115200;
	    huart6.Init.WordLength             = UART_WORDLENGTH_8B;
	    huart6.Init.StopBits               = UART_STOPBITS_1;
	    huart6.Init.Parity                 = UART_PARITY_NONE;
	    huart6.Init.Mode                   = UART_MODE_TX_RX;
	    huart6.Init.HwFlowCtl              = UART_HWCONTROL_NONE;
	    huart6.Init.OverSampling           = UART_OVERSAMPLING_16;
	    huart6.Init.OneBitSampling         = UART_ONE_BIT_SAMPLE_DISABLE;
	    huart6.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;

 

Should have something like this within your code above. 

huart6.Init.ClockPrescaler = UART_PRESCALER_DIV1;

 

 

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
Hi Karl,
 
Thanks for pointing that out.
 
Have a great day,
Glenn

Hi Karl,

That was it! Thanks!

Glenn

BarryWhit
Lead II

How can the wrong value for an integer divisor prescaler cause a 15% error in baud rate?!

If DIV=1 gives you the expected baud rate, and this really was the cause behind your issue, that would mean that the integer-valued prescaler was previously set to DIV=1.15, which is impossible.

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.

Exactly, I think we're getting a very selective view of the facts/details, as on it's own that makes no rational sense.

Perhaps it breaks the math for the BRR computation, but none of the register values has been shared or contextualized. Details of the memory the variables reside in, or the structure content as passed to the initialization routine.

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