Skip to main content
YPear.1
Associate II
May 6, 2021
Question

Default SystemClock_Config fails

  • May 6, 2021
  • 4 replies
  • 1241 views

I started a default project and the system clock fails initialization. Does the SDK have a bug?

thanks,

cubemx 6.2

Nucleo F429ZI dev kit

makefile

gcc

ubuntu 20

This topic has been closed for replies.

4 replies

ST Technical Moderator
May 7, 2021

Hello @YPear.1​ ,

What about the clock configuration used? 

Would it be possible to provide the source code which shows the problem?

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
waclawek.jan
Super User
May 7, 2021

> the system clock fails initialization

What are the symptoms? What do you try to accomplish? Did you debug/step through the given function?

JW

YPear.1
YPear.1Author
Associate II
May 7, 2021

To reproduce the issue:

  1. install mx cube 6.2
  2. Select "Start my project from ST Board"
  3. Select NUCLEO-F429ZI
  4. Initialize all periperals with their default mode --> YES
  5. Name Project
  6. Select MAKEFILE toolchain
  7. Use latest available firmware version (FW_F4 v1.26.1)
  8. Click on Generate Code
  9. Build firmware (make)
  10. Flash firmware (st-flash --reset write build/projectname.binn 0x8000000
  11. Use GDB to step into code

HAL_RCC_OscConfig(&RCC_OscInitStruct):138

This function call returns HAL_ERROR

The IF statement fails in line stm2f4xx_hal_rcc.c line 552

if (((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_OFF) || │
 │553 (READ_BIT(pll_config, RCC_PLLCFGR_PLLSRC) != RCC_OscInitStruct->PLL.PLLSource) || │
 │554 (READ_BIT(pll_config, RCC_PLLCFGR_PLLM) != (RCC_OscInitStruct->PLL.PLLM) << RCC_PLLCFGR_PLLM_Pos) || │
 │555 (READ_BIT(pll_config, RCC_PLLCFGR_PLLN) != (RCC_OscInitStruct->PLL.PLLN) << RCC_PLLCFGR_PLLN_Pos) || │
 │556 (READ_BIT(pll_config, RCC_PLLCFGR_PLLP) != (((RCC_OscInitStruct->PLL.PLLP >> 1U) - 1U)) << RCC_PLLCFGR_PLLP_Pos) || │
 │557 (READ_BIT(pll_config, RCC_PLLCFGR_PLLQ) != (RCC_OscInitStruct->PLL.PLLQ << RCC_PLLCFGR_PLLQ_Pos))) │
 │558 #endif │
 │559 { │
 │560 return HAL_ERROR; │
 │561 }

Any idea?

I'm not adding or removing anything from the default setup for the ST dev kit

waclawek.jan
Super User
May 8, 2021

I understand your frustration, but I don't use Cube/CubeMX.

That line basically says, that if you already use PLL as system clock, and request the function to change its parameters, that is an error. Basically, there should be no reason to call that function twice, or set PLL anywhere else.

JW