cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 Clock unable to reach 216 MHz

Mathieu Frohlich
Associate II
Posted on April 11, 2017 at 16:03

Hi,

I'm facing an issue with a new project I'm working on, I just received a custom board based on a STM32F746VGT6 MCU, the MCU wasn't able to run my base program, (generated via MXCube), so I started changing parameters to find the source, and it led me to this : when I bring the clock speed down my program run without problems. But when I run with frequencies above ~120MHz, then the program stop working. For now my program just toggle 2 GPIOs : one in the systick handler and the other in a timer interrupt.

At first I thought it could be a problem between openocd and the board, but even without the debugger the program wont run above 140MHz. I'm using a 8MHz crystal oscillator as clock source, below is the source code of the

SystemClock_Config() function from my program. When I bring

RCC_OscInitStruct.PLL.PLLN below ~ 240 my program runs. But when I go up in frequencies my program goes in Hardfault at random places.

void SystemClock_Config(void)
{
 RCC_OscInitTypeDef RCC_OscInitStruct;
 RCC_ClkInitTypeDef RCC_ClkInitStruct;
 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
 /**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_HSE;
 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
 RCC_OscInitStruct.PLL.PLLM = 8;
 RCC_OscInitStruct.PLL.PLLN = 432;
 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
 RCC_OscInitStruct.PLL.PLLQ = 9;
 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
 {
 Error_Handler();
 }
/**Activate the Over-Drive mode */
 if (HAL_PWREx_EnableOverDrive() != HAL_OK)
 {
 Error_Handler();
 }
/**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_DIV4;
 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
 {
 Error_Handler();
 }
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART2|RCC_PERIPHCLK_CLK48;
 PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
 PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
 PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2;
 PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4;
 PeriphClkInitStruct.PLLSAIDivQ = 1;
 PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
 PeriphClkInitStruct.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
 PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLLSAIP;
 if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
 {
 Error_Handler();
 }
/**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, 2, 0);
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

If you need other part of my program I'd be glad to send it to you, thanks a lot for your help !

Cheers,

Mathieu

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on April 11, 2017 at 18:14

Check voltage and capacitors on VCAP pins.

Check internal frequency via MCO (PA8) pin.

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

View solution in original post

5 REPLIES 5
Imen.D
ST Employee
Posted on April 11, 2017 at 16:15

Hi

primitive

,

Which CubeMx version are you using ?

Please make sure to use the latest version of CubeMx v4.1 which fixes RCC config issue.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on April 11, 2017 at 18:14

Check voltage and capacitors on VCAP pins.

Check internal frequency via MCO (PA8) pin.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Sirma Siang
ST Employee
Posted on June 23, 2017 at 18:28

Hello Mathieu,

First I thank you for your feedback.

To be able to reproduce it at my end, could you please share your ioc ?

Could you detail a bit your environment (what is your operating system, which cube version are you using, which FMW library) ?

Have you check what CLive has suggested ?

Great thanks in advance.

KR

Sirma

Posted on July 13, 2017 at 11:18

Hello Mathieu,

Using STM32CubeMX 4.21 andthe STM32F7 discovery kit for the STM32F746 MCU, I have replicated the configuration of your

SystemClock_Config() function with the exception of the RCC_OscInitStruct.PLL.PLLM setting (because the external clock on the board is 25MHz, therefore I have RCC_OscInitStruct.PLL.PLLM = 25; instead of RCC_OscInitStruct.PLL.PLLM = 8;). With this configuration, my program successfully runs at the system clock frequency of 216MHz (HCLK = 216 MHz max).

When I force the input frequency to 8 MHz and set PLLM to 8 in STM32CubeMX to be in exactly your configuration, the code generated no longer runs on the STM32F7 discovery kit because the external clock is 25 MHz.

Regards,

Angus

P.S. Please find attached my IOC file.

________________

Attachments :

F746-DISCO.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyWS&d=%2Fa%2F0X0000000b9b%2Fw5aEg45QkO2hUlzL.WivPHSKpTwzp6ZbBmoYiOvx3tg&asPdf=false
Posted on October 03, 2017 at 17:26

Thanks a lot, it was indeed a badly soldered VCAP capacitor !