Skip to main content
Heinz_Baumer
Associate II
October 31, 2025
Question

STMCubeMx 6.15.0 Bug in UART ClockPrescaler code generation

  • October 31, 2025
  • 1 reply
  • 152 views

When generating code with CubeMx version 6.15.0 there is a bug.

No ClockPrescaler setting is found in the generaded code at the UART'S

MCU: STM32H563
Peripherals: USART1,2,3 and LPUART1

When you generated the Code, a ClockPrescaler was not generated  (missing).

The Code goes in Error-Handler, because Prescaler is 1 by default.

 

/**
 * @brief LPUART1 Initialization Function
 * @PAram None
 * @retval None
 */
static void MX_LPUART1_UART_Init(void)
{

 /* USER CODE BEGIN LPUART1_Init 0 */

 /* USER CODE END LPUART1_Init 0 */

 /* USER CODE BEGIN LPUART1_Init 1 */
 
 // #### THIS WAS NOT GENERATED by STM32CubeMX: #### 
	// #### Code goes in Error_Handler ####
	 hlpuart1.Init.ClockPrescaler = UART_PRESCALER_DIV16;
 /* USER CODE END LPUART1_Init 1 */
 
 hlpuart1.Instance = LPUART1;
 hlpuart1.Init.BaudRate = 9600;
 hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
 hlpuart1.Init.StopBits = UART_STOPBITS_1;
 hlpuart1.Init.Parity = UART_PARITY_NONE;
 hlpuart1.Init.Mode = UART_MODE_TX_RX;
 hlpuart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 hlpuart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
 hlpuart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
 hlpuart1.FifoMode = UART_FIFOMODE_DISABLE;
 if (HAL_UART_Init(&hlpuart1) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_UARTEx_SetTxFifoThreshold(&hlpuart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_UARTEx_SetRxFifoThreshold(&hlpuart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_UARTEx_DisableFifoMode(&hlpuart1) != HAL_OK)
 {
 Error_Handler();
 }
 /* USER CODE BEGIN LPUART1_Init 2 */

 /* USER CODE END LPUART1_Init 2 */

}

 

1 reply

Ghofrane GSOURI
Technical Moderator
October 31, 2025

Hello @Heinz_Baumer 

Thank you for your valuable contribution.

We have already identified this issue and escalated it to our development team under Ticket 218732. Rest assured, it is being prioritized and will be resolved as soon as possible.

THX

Ghofrane

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.