cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32F413RHT6] Clock speed problem

nicolas b
Associate III
Posted on April 05, 2018 at 10:56

We are trying to increase the clock speed of our STM32 on our custom board but we encountered some difficulties.

At the moment, we set a clock of 56 MHz, using HSI and an PLL of 112 (with CubeMx). It works fine.

But when we set a clock of 96 MHz by setting the PLL to 192, we get Hard Fault, Usage Fault or Bus Fault when debugging.

We tried increasing the flash latency, but it does not work better. The power supply seems good (around 3,2 V).

We were missing the Vcap on the board, but we fix that. Not better.

What can we look at to debug this problem ?

#cpu-clock-frequency
1 ACCEPTED SOLUTION

Accepted Solutions
nicolas b
Associate III

We did a second version of our design with a more stable power supply and it seems to fix the problem.

Thank you all for your help.

View solution in original post

12 REPLIES 12
Posted on April 05, 2018 at 12:56

Check settings of VOS bits. Review state of internal clocks via MCO pin PA8.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
nicolas b
Associate III
Posted on April 12, 2018 at 11:42

We tried changing the VOS bits with no luck.

The problem seems to arise when the systick interrupt is started.

P.S: we do not have access to MCO for now.

nicolas b
Associate III
Posted on May 04, 2018 at 09:54

We tested the MCO pins. Clock frequencies seem normals.

We noticed that sometimes the PLL clock stopped. But we do not know if it is the micro which crashes and stop the PLL or the PLL which stops and crash the micro.

MCO pins:

0690X00000602VpQAI.bmp0690X0000060ApTQAU.png
Jaroslav BECKA
ST Employee
Posted on May 04, 2018 at 10:05

Hello Nicola,

please check the configuration of APB1 prescaler. The frequency of 96 MHz exceeds the limit of 50 MHz for APB1.

Verify the configuration once again in STM32CubeMX Clock Configuration wizard. It highlights wrong clock settings.

Let us know about the results.

Best regards,

Jaroslav

Posted on May 04, 2018 at 10:15

Hello,

The APB1 prescaler is set to 2. We use CubeMx to configure the clock and there are no highlights.

The generated code:

void SystemClock_Config(void)

{

  RCC_OscInitTypeDef RCC_OscInitStruct;

  RCC_ClkInitTypeDef RCC_ClkInitStruct;

    /**Configure the main internal regulator output voltage

    */

  __HAL_RCC_PWR_CLK_ENABLE();

  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

    /**Initializes the CPU, AHB and APB busses clocks

    */

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

  RCC_OscInitStruct.HSIState = RCC_HSI_ON;

  RCC_OscInitStruct.HSICalibrationValue = 16;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

  RCC_OscInitStruct.PLL.PLLM = 16;

  RCC_OscInitStruct.PLL.PLLN = 192;

  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

  RCC_OscInitStruct.PLL.PLLQ = 2;

  RCC_OscInitStruct.PLL.PLLR = 2;

  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

  {

    _Error_Handler(__FILE__, __LINE__);

  }

    /**Initializes the CPU, AHB and APB busses clocks

    */

  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

                              |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_3) != HAL_OK)

  {

    _Error_Handler(__FILE__, __LINE__);

  }

  HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_2);

  HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_PLLCLK, RCC_MCODIV_1);

    /**Configure the Systick interrupt time

    */

  HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

    /**Configure the Systick

    */

  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

  /* SysTick_IRQn interrupt configuration */

  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

}

I think the configuration is good, because it works well on a Nucleo.

But on our custom board it does not work and we are searching ways of investigate this problem.

Posted on May 04, 2018 at 11:44

Hi Nicola,

can you attach your circuit diagram (the microcontroller part especially), so that I can check it?

You can also refer to the application note (AN4488: Getting Started with STM32F4xxxx MCU hardware development) that describes each pin and contains also reference circuit diagram.

If you get fault exceptions, you can make use of the registers in System Control Block in the ARM Cortex-M4 core that control fault exceptions and provide information of their cause.

There is an application note from arm (AN209: Using Cortex-M3/M4/M7 Fault Exceptions) that thoroughly describes the exceptions and possible causes.

You may also find useful our application note (AN4989: STM32 microcontroller debug toolbox) that contains hints and tips for debugging.

If the same code is running well on a development boards, it indicates possible hardware issue.

I hope it helps. Good luck!

Best regards,

Jaroslav

Posted on May 04, 2018 at 14:02

I do not know if I can disclose the circuit diagram for now but we will check those application notes and try to identify the cause of the fault.

Thanks for the advices.

Posted on May 06, 2018 at 12:38

We noticed that sometimes the PLL clock stopped.

That sounds alarming. I'd double-check the analog ground and power pins, also taking into consideration bad solder joints on the pins.

JW

Adam I.
Associate
Posted on May 17, 2018 at 18:23

Hi, d

id you solve the problem?

I

have an identical problem but with STM32F401RBT6, on nucleo all works, on my PCB fault as above. Errors are sometimes different(INVSTATE, PGSERR, PRECISERR, BFARVALID, BFAR, MMFAR, PGSERR) and occur in a random program location, at about >50-60Mhz, regardless of the periphery.

EDIT: The problem solved ... the Vcap 4.7uF capacitor must be really low ESR, or better 2x2.2uF.

Below my configuration. I added extra 100nF for NRST.0690X0000060Kp7QAE.png