Skip to main content
Jiannong Zhou
Associate III
November 14, 2021
Question

Newly generated code by SMT32CubeMX (6.1.1) hang at SystemClock_Config().

  • November 14, 2021
  • 3 replies
  • 899 views

Newly generated code by SMT32CubeMX (6.1.1) hang at SystemClock_Config(). the hardware can boot up with the old code generated by STM32CubeMX previously.

Further investigation showed

__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSI or ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)) is false

  /* Check if HSI is used as system clock or as PLL source when PLL is selected as system clock */ 

  if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSI) 

    || ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)))

The file - system_stm32f3xx.c is different code

 /* Reset the RCC clock configuration to the default reset state ------------*/

 /* Set HSION bit */

 RCC->CR |= 0x00000001U;

 /* Reset CFGR register */

 RCC->CFGR &= 0xF87FC00CU;

 /* Reset HSEON, CSSON and PLLON bits */

 RCC->CR &= 0xFEF6FFFFU;

 /* Reset HSEBYP bit */

 RCC->CR &= 0xFFFBFFFFU;

 /* Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE bits */

 RCC->CFGR &= 0xFF80FFFFU;

 /* Reset PREDIV1[3:0] bits */

 RCC->CFGR2 &= 0xFFFFFFF0U;

 /* Reset USARTSW[1:0], I2CSW and TIMs bits */

 RCC->CFGR3 &= 0xFF00FCCCU;

 /* Disable all interrupts */

 RCC->CIR = 0x00000000U;

But I added this code into new code. it's the same, still hang. And also use the same *ioc file to generate the code by STM32CubeMXIDE. it can boot up.

Please any bode help to give your ideas. thanks.

Regards,

Jiannong

This topic has been closed for replies.

3 replies

ST Technical Moderator
November 16, 2021

Hello @Community member​ ,

Can you please use the latest release of STM32CubeMx v6.3 ?

If you still have the same issue with the latest release, please share your ioc file to try reproduce this from my side.

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
Jiannong Zhou
Associate III
November 17, 2021

Hi Imen,

I tried STM32CubeMX V6.3. the issue is the same. Actually, the ioc file is very simple, only enable internal clock.

I tried to use STM32CubeIDE to open the same ioc file and it works.

Also when use new revision of STM32CubeMX, there are some other issues

  1. Broken option were detected in project file
  2. Contains the unknown tool "NULINK_ID". there are some build errors. after re-generate the code, the build issue was gone.

Please advise on what these issues cause. Any IAR revision requirement?

Thanks,

Jiannong

ST Technical Moderator
November 18, 2021

Adding @Khouloud OTHMAN​ , @Khouloud ZEMMELI​ from CubeMx team to review and confirm this issue in CubeMX tool.

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