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

USART Clock selection bug / cubemx

  • October 3, 2023
  • 2 replies
  • 1399 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

2 replies

Peter BENSCH
Peter BENSCHBest answer
ST 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

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