cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 CLOCK CONFIGURATION PROBLEM

zekeriya
Associate II
Posted on March 27, 2017 at 08:43

I am trying to configure HSE clock with 8Mhz crystal with STM32F429.

HAL_ERROR occurs when HAL_RCC_OscConfig function is executed in the following partition.

  /*----------------------------- HSI Configuration --------------------------*/

  if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI)

  {

    /* Check the parameters */

    assert_param(IS_RCC_HSI(RCC_OscInitStruct->HSIState));

    assert_param(IS_RCC_CALIBRATION_VALUE(RCC_OscInitStruct->HSICalibrationValue));

    

    /* 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_CFGR_SWS_HSI) ||\

      ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSI)))

    {

      /* When HSI is used as system clock it will not disabled */

      if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) && (RCC_OscInitStruct->HSIState != RCC_HSI_ON))

      {

        return HAL_ERROR;//Always this line works

      }

Actually HSE is running and ready, but the problem in HSI causes HAL_ERROR to return.

Error_Handler () is constantly running in this section with the reason for this problem.

    /**Initializes the CPU, AHB and APB busses clocks

    */

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;

  RCC_OscInitStruct.HSEState = RCC_HSE_ON;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

  RCC_OscInitStruct.PLL.PLLM = 8;

  RCC_OscInitStruct.PLL.PLLN = 336;

  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

  RCC_OscInitStruct.PLL.PLLQ = 7;

  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

  {

    Error_Handler();

  }

I need help

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee
Posted on April 04, 2017 at 18:29

Hello All,

I would inform you that a new patch 

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

  V 4.20.1 is available to fix this issue.

Sorry for any inconvenience this may cause you.

Imen

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

View solution in original post

18 REPLIES 18
Imen.D
ST Employee
Posted on March 27, 2017 at 10:27

Hello,

This is confirmed bug in clock configuration with 

CubeMx 4.20 and will be fixed soon

in the new patch release.

We apologize for any inconvenience this may cause.

 Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Zt Liu
Senior III
Posted on March 27, 2017 at 10:28

Hey, 

I got this problem too in Nucleo STM32F446.

I solved it by modifying the followings:

Change

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;

to:

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

Posted on March 27, 2017 at 10:48

Thank you Zhitai Liu for reply but,

When I make this change, the processor becomes completely inoperable. It becomes flashing impossible. In order to get rid of this situation, I dismount the crystal and take it back again and start it again. So the processor becomes operational again. After that I put the crystal back in place. So I can get back to the beginning of the problem.

Posted on March 27, 2017 at 14:26

Hi!

I confirm that this bug is also present for STM32F072RB micros.

Thanks!

Posted on March 30, 2017 at 00:43

DAHMEN.IMEN

‌: Do you have an ETA for this patch release?

Posted on April 03, 2017 at 16:53

Liu.Zhitai

thank you. I make this change and all is ok!

Posted on April 04, 2017 at 11:08

I tried your solution again and this time it worked. I think crystal was a problem before. Thank you

Imen.D
ST Employee
Posted on April 04, 2017 at 18:29

Hello All,

I would inform you that a new patch 

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

  V 4.20.1 is available to fix this issue.

Sorry for any inconvenience this may cause you.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Zt Liu
Senior III
Posted on April 05, 2017 at 03:44

Does any one check that CubeMX 4.20.1 really solve this issue?

In my F446 project, I still need to comment out 

RCC_OSCILLATORTYPE_HSI| to make HSE configured.