cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 HAL RCC ClockConfig Hard Fault at >65°C

roger
Associate II
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

4 REPLIES 4
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
Up vote any posts that you find helpful, it shows what's working..
Nesrine M_O
Lead II
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-

Posted on March 26, 2018 at 18:36

What's in RCC_ClkInitStruct?

JW

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
Up vote any posts that you find helpful, it shows what's working..