2025-11-04 2:00 AM - edited 2025-11-04 2:22 AM
Hello.
In CubeMX, there is a Bug with a wrong Clock of USART2 and a wrong BRR-Value
I've used CubeMX to configure the Clock, based on the Nucleon-H563.
For the USART2, i want to use the stable crystal oszillator (25MHz) from the Board (not the HSI-Clock)
So i configure a 125MHz-Clock on PLL2Q and set this as clock for USART2.
The Baudrate should be: 9600.
After generating code, the baudrate of USART2 ist 3078,81 Baud (measured).
To calculate the uart baudrate divider (USART2_BRR), MX use the: STM32Cube_FW_H5_V1.5.0\Drivers\STM32H5xx_HAL_Driver\Src\stm32h5xx_hal_uart.c
In Function: UART_SetConfig(UART_HandleTypeDef *huart) Line 3329, the usartdiv is calculated with: 407
( (125000000 / 32) + ((9600)/2)) / 9600 = 407
But with this, a wrong baudrate is generated (3078,81Baud)
If i use 130 as divider, the Baudrate is near correct, because the USART-Clock seems to be 39,9013776MHz instead of 125MHz .
What is the reason for the wrong clock of PLL2Q or the BRR?
2025-11-04 2:23 AM
Hello @Heinz_Baumer ,
Let me thank you for posting.
Your request is under investigation, and I will get back to you as soon as possible.
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.