cancel
Showing results for 
Search instead for 
Did you mean: 

Bug report: PLL configuration in HAL_RCC_OscConfig() returns HAL_ERROR, if HSE is configured and PLL is the system clock source

TS1
Associate

Working with the STM32F429 Discovery board and STMCube_FW_F4_V1.21.0 I've got the same problem several times.

If I use the main.c provided with the application examples, the code will run into an endless loop after calling HAL_RCC_OscConfig and taking care of the return value.

The program works as expected, if the return value is ignored.

The configuration of the PLL causes this behaviour:

The check, if the PLL is used as system clock source will go to the else path and returns HAL_ERROR. The calling function expects HAL_OK.

2 REPLIES 2
Khouloud GARSI
Lead II

Hi @Torsten Schönitz​ ,

I'm not able to reproduce your issue. The "HAL_ERROR" should not be called if everything is configured correctly (I'm supposing your board is ok).

For further debug, you may share a project that is not working for you, I will check it using our HW.

Khouloud.

TS1
Associate

Hi Khouloud,

I'm new to this community and just don't know, how to share the whole project.

But perhaps you can tell me, what should happen, when the function HAL_RCC_OscConfig () comes to the configuration of the PLL:

  /*-------------------------------- PLL Configuration -----------------------*/
  /* Check the parameters */
  assert_param(IS_RCC_PLL(RCC_OscInitStruct->PLL.PLLState));
  if ((RCC_OscInitStruct->PLL.PLLState) != RCC_PLL_NONE)
  {
    /* Check if the PLL is used as system clock or not */
    if(__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL)
    {
      if((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_ON)
      {
        /* Check the parameters */
        assert_param(IS_RCC_PLLSOURCE(RCC_OscInitStruct->PLL.PLLSource));
        assert_param(IS_RCC_PLLM_VALUE(RCC_OscInitStruct->PLL.PLLM));
        assert_param(IS_RCC_PLLN_VALUE(RCC_OscInitStruct->PLL.PLLN));
        assert_param(IS_RCC_PLLP_VALUE(RCC_OscInitStruct->PLL.PLLP));
        assert_param(IS_RCC_PLLQ_VALUE(RCC_OscInitStruct->PLL.PLLQ));

In my projects the if-statement (if PLL is used as system clock) is false, because the system clock source is equal to RCC_CFGR_SWS_PLL. So the else path will be selected, that is returning HAL_ERROR.

The projects are working as expected, if I ignore the return value in the calling function.

Torsten