cancel
Showing results for 
Search instead for 
Did you mean: 

Default SystemClock_Config fails

YPear.1
Associate II

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

4 REPLIES 4
Imen.D
ST Employee

Hello @YPear.1​ ,

What about the clock configuration used? 

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

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

> 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
Associate II

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

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