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

18 REPLIES 18
Posted on April 05, 2017 at 08:24

 ,

 ,

Hello Imen,

I installed version 4.20.1. But the problem continues.

If I do not change the RCC line like this,it is waiting in the infinite

loop at the Error_Handler().

//RCC_OscInitStruct.OscillatorType =

RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE,

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE,

Thank you

Zekeriya Altınordu

4.04.2017 19:30 tarihinde Imen D yazdı:

>,

STMicroelectronics Community

<,https://community.st.com/?et=watches.email.thread>,

>,

Re: STM32F429 CLOCK CONFIGURATION PROBLEM

reply from Imen D

<,

in /STM32 MCUs Forum/ - View the full discussion

<,https://community.st.com/0D70X000006ScjCSAS

>,

Imen.D
ST Employee
Posted on April 05, 2017 at 10:52

Hi,

This issue is resolved with the new patch and I have checked this by creating a new project to have the correct configuration.

But, as you are using an old .ioc project, you should first EDIT the .ioc file and REMOVE this line (remove the RCC.OscillatorType that you don't need)

RCC.OscillatorTypeHSI=RCC_OSCILLATORTYPE_HSI

Then re-generate the project, this will resolve your problem.

Please keep me informed about your updates.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on April 05, 2017 at 10:02

CubeMX 4.20.1 have solved this issue,

I just tried it

。
Posted on April 05, 2017 at 10:34

After installing CubeMX 4.20.1, I saw that the problem persists. After a while, I noticed that the generated code came in the way Zhitai Liu proposed. Then I added USB OTG FS (Device only) and Class For FS IP (Mass storage Class) to the CubeMX project. In this case, when I install the generated code, STLinkV2 becomes inoperable with the processor. To return to the previous state, I am disassembling the crystal. In this case, STLinkV2 becomes operational again. I remove the USB related stuff from the project and generate the code again. After installing the generated code, when I plug in the crystal again, the processor becomes working again with HSE. I think the problem is now with USB, not with HSE work.

Posted on April 05, 2017 at 12:20

Okay, I modify the RCC settings to HSI and then re-modify to HSE again as I need and then regenerate the project, now it's working. Thanks Imen!

Posted on April 05, 2017 at 21:09

Did the STM32CubMX 4.20.1 not get posted to the auto-updater? When I Help >

Check for updates, I get nothing.

<>< <>< <><

Bryce Schober

On Tue, Apr 4, 2017 at 9:30 AM, Imen D <st-microelectronics@jiveon.com>

Posted on April 06, 2017 at 09:45

Hi

Schober.Bryce

,

The patch STM32CubeMx 4.1 is available in the ST web and you can download it from this link

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

.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on April 06, 2017 at 22:17

When I originally asked, STM32CubeMx 4.20.1 was not found in the update

manager. Now it is.

<>< <>< <><

Bryce Schober

On Thu, Apr 6, 2017 at 2:55 AM, Imen D <st-microelectronics@jiveon.com>

Posted on April 07, 2017 at 10:40

Hi

Schober.Bryce

,

This is due to the synchronization issue between CubeMx tool and the update of new version in the web.

Thanks

Imen

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