Skip to main content
EGonc.3
Associate
August 18, 2021
Question

HAL_RCC_OscConfig timeout

  • August 18, 2021
  • 3 replies
  • 1887 views

On initialisation SystemClock_Config(0 calls the function HAL_RCC_OscConfig() and this generates a timeout on the loop below:

   /* Set the new HSE configuration ---------------------------------------*/

   __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState);

   /* Check the HSE State */

   if(RCC_OscInitStruct->HSEState != RCC_HSE_OFF)

   {

    /* Get Start Tick*/

    tickstart = HAL_GetTick();

    /* Wait till HSE is ready */

    while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == 0U)

    {

     if((uint32_t) (HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE)

     {

      return HAL_TIMEOUT; <<------

     }

    }

Any ideas what could be the cause of this and how to solve it?

thanks

    This topic has been closed for replies.

    3 replies

    Peter BENSCH
    ST Technical Moderator
    August 18, 2021

    Are you using a simulator or an RTOS?

    What are your settings for the HSE timeout value (see block RCC, if created using CubeMX/CubeIDE)?

    Regards

    /Peter

    In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    EGonc.3
    EGonc.3Author
    Associate
    August 18, 2021

    regarding your questions:

    >Are you using a simulator or an RTOS?

    I'm using FreeRTOS

    The HAL_Ticker seems to be working fine.

    >What are your settings for the HSE timeout value (see block RCC, if created using CubeMX/CubeIDE)?

    I have used CubeMX to generate the configuration.

    I'm using a STM32H7A3 processor on a Nucleo board, and somehow the RCC was wrong.

    Now it's High Speed Clocmk = Crystal/Ceramic Resonator

    Low Speed Clock: Disable

    (For some reason it was enabling the Low Speed Clock!)

    Still I have a problem now:

    When is calling HAL_GetTick() on the second call below it generates an error: <signal handler called>() at 0xfffffff9

       /* Get Start Tick*/

       tickstart = HAL_GetTick();

        while (__HAL_RCC_GET_SYSCLK_SOURCE() != (RCC_ClkInitStruct->SYSCLKSource << RCC_CFGR_SWS_Pos))

        {

         if((HAL_GetTick() - tickstart ) > CLOCKSWITCH_TIMEOUT_VALUE) <----

         {

          return HAL_TIMEOUT;

         }

        }

    Javier1
    Principal
    August 23, 2022

    I have the same issue, a custom board that was already working i created a simple project and never gets pass SystemClock_Config();

    Doesnt matter if i use HSE or HSI

    my timeout values are the default ones

    0693W00000QOIsNQAX.png

    hit me up in https://www.linkedin.com/in/javiermuñoz/