Skip to main content
roger
Associate II
March 26, 2018
Question

STM32 HAL RCC ClockConfig Hard Fault at >65°C

  • March 26, 2018
  • 4 replies
  • 1366 views
Posted on March 26, 2018 at 17:52

Hi

I have following Problem:

At <65 °C ambient temperature and PowerOff-On.

My STM32f373 works fine.

At> 65 ° C ambient temperature and PowerOff-On

I get a HardFault Error at the following function:

void SystemClock_Config(void)

{

 .............

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)

  {

    _Error_Handler(__FILE__, __LINE__);

  }

  ............

}

What is wrong?

Can someone help me ?

Kind regards

Roger

    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    March 26, 2018
    Posted on March 26, 2018 at 18:18

    Try increasing the wait states, assuming you are running at 72 MHz

    Observe the performance of the supply at/over temperature profile.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Nesrine M_O
    Associate
    March 26, 2018
    Posted on March 26, 2018 at 18:28

    Hi

    Schweizer.Roger

    ,

    Can you output theclock on MCO ? we need to check if there is any deviation of the clock when increasing temperature.

    -Nesrine-

    waclawek.jan
    Super User
    March 26, 2018
    Posted on March 26, 2018 at 18:36

    What's in RCC_ClkInitStruct?

    JW

    Tesla DeLorean
    Guru
    March 26, 2018
    Posted on March 26, 2018 at 19:11

    Hopefully something like this, uphill skiing is no fun at low levels of difficulty..

    /**

      * @brief  System Clock Configuration

      *         The system Clock is configured as follow :

      *            System Clock source            = PLL (HSE)

      *            SYSCLK(Hz)                     = 72000000

      *            HCLK(Hz)                       = 72000000

      *            AHB Prescaler                  = 1

      *            APB1 Prescaler                 = 2

      *            APB2 Prescaler                 = 1

      *            HSE Frequency(Hz)              = 8000000

      *            HSE PREDIV                     = 1

      *            PLLMUL                         = RCC_PLL_MUL9 (9)

      *            Flash Latency(WS)              = 2

      * @param  None

      * @retval None

      */

    static void SystemClock_Config(void)

    {

      RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; // Clear autos for safety

      RCC_OscInitTypeDef RCC_OscInitStruct = {0};

      /* Enable HSE Oscillator and activate PLL with HSE as source */

      RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

      RCC_OscInitStruct.HSEState = RCC_HSE_ON; // Or BYPASS for external source

      RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;

      RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

      RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

      RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;

      if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK)

      {

        Error_Handler();

      }

      /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2

         clocks dividers */

      RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);

      RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

      RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

      RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;

      RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

      if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2)!= HAL_OK)

      {

        Error_Handler();

      }

    }
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..