2024-07-12 08:08 AM
STM32H753 UART Baud is 15% low. I set it to 115200, but it's running at 98400. Is this a misconfigured clock?
Solved! Go to Solution.
2024-07-12 01:38 PM
> Why do you say they look cube-generated? There are no MX_ functions called, just HAL.
Because of the comments and other style hints.
2024-07-12 06:33 PM
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;
2024-07-15 07:01 AM
2024-07-15 08:06 AM
Hi Karl,
That was it! Thanks!
Glenn
2024-07-15 08:19 AM - edited 2024-07-15 08:58 AM
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.
2024-07-15 08:39 AM
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.