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;

 

 

 

If you find my answers useful, click the accept button so that way others can see the solution.
Hi Karl,
 
Thanks for pointing that out.
 
Have a great day,
Glenn

Hi Karl,

That was it! Thanks!

Glenn

BarryWhit
Senior III

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 a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.

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..