Skip to main content
DBroo.1
Associate III
September 11, 2019
Question

STM32CubeMX V5.3.0 does not generate correct code for SystemClock_Config()

  • September 11, 2019
  • 3 replies
  • 719 views

Anyone aware of this problem and any workaround, other than manually changing the generated file? Specifically, ​ RCC_OscInitStruct.PLL.PLLR,  RCC_OscInitStruct.PLL.PLLP and

 RCC_OscInitStruct.PLL.PLLR are not being configured correctly, causing the first call to HAL_GetTick() inside HAL_RCC_OscConfig() to crash.

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
September 12, 2019

For what STM32 part? Trying to narrow this down a bit.

Make sure SystemClock_Config() zeros out the local/auto variable.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
DBroo.1
DBroo.1Author
Associate III
September 12, 2019

​Sorry Clive. It's the STM32G070CB. And to be more specific, these parameters were configured on the Clock Configuration Tab in Cube as:

RCC_OscInitStruct.PLL.PLLN = 9

RCC_OscInitStruct.PLL.PLLP = 3

RCC_OscInitStruct.PLL.PLLR  = 3,

but the code generated:

RCC_OscInitStruct.PLL.PLLN = 8

RCC_OscInitStruct.PLL.PLLP = 2

RCC_OscInitStruct.PLL.PLLR = 2.

HOWEVER, in trying to pull this information together for you this morning, Cube generated the correct code this time. ??? I have been quite careful to save the project before generating code, but "Generate Code" saves the project anyway. So, I am not sure what is going on.

DBroo.1
DBroo.1Author
Associate III
September 25, 2019

​Resolved