Skip to main content
Aurelien Robert
Associate III
October 3, 2023
Solved

USART Clock selection bug / cubemx

  • October 3, 2023
  • 1 reply
  • 1381 views

Hello,

With CubeMX V6.8 (I did not check with latest update), there is a bug in the USART clock source selection, for chip STM32L451VET

When selecting SYSCLK for USART2 or USART3 (did not check with UART4), in the function HAL_UART_MspInit() the clock is init with :

PeriphClkInit.Usart2ClockSelection = RCC_USART1CLKSOURCE_SYSCLK;

instead of 

PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_SYSCLK;

That results in an incorrect initialisation !

I don't know if it is related to the fact that in my project USART1 is also clocked by RCC_USART1CLKSOURCE_SYSCLK

Aurelien

 

This topic has been closed for replies.
Best answer by Peter BENSCH

I have just tried to reproduce your problem - at least the current versions of STM32CubeMX and STM32CubeIDE generate the correct USART ClockSelection.

Hope that helps?

Regards
/Peter

1 reply

Peter BENSCH
Peter BENSCHBest answer
Technical Moderator
October 4, 2023

I have just tried to reproduce your problem - at least the current versions of STM32CubeMX and STM32CubeIDE generate the correct USART ClockSelection.

Hope that helps?

Regards
/Peter

Aurelien Robert
Associate III
October 4, 2023

Hello Peter

I'm deeply sorry for my mistake, it's my only fault when I copied the init parameter from a project copy regenerated with cubemx to my previous project, I copied the same line for the three UART without thinking...

Thank you and sorry again

Aurelien