cancel
Showing results for 
Search instead for 
Did you mean: 

Core Clock speed

mahmoud boroumand
Associate III
Posted on January 30, 2018 at 13:21

hello is use stm32f30p4 and use 8000000 hse_value and use cmsis.

i change SystemCoreClock in the system_stm32f0xx.c to 8000000 but my clock doesn't change and still work on 48MHZ.how can i fix it?

SystemInit();

SystemCoreClockUpdate();

while (!RCC_WaitForHSEStartUp());

/** @addtogroup STM32F0xx_System_Private_Variables

* @{

*/

uint32_t SystemCoreClock = 8000000;
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on January 30, 2018 at 14:10

You'd need to change the clock and PLL settings, likely in system_stm32f0xx.c and called by SystemInit()

The value for SystemCoreClock is then recomputed for the settings in effect.

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

3 REPLIES 3
Posted on January 30, 2018 at 14:10

You'd need to change the clock and PLL settings, likely in system_stm32f0xx.c and called by SystemInit()

The value for SystemCoreClock is then recomputed for the settings in effect.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jg_spitfire
Senior
Posted on April 03, 2018 at 12:25

Hi,

Bromand.Mahmoud

‌ could you change the core clock while running the stm32?, i am trying with this:

SystemCoreClock=50000000; //(50Mhz)

clockconfig.ClockType=RCC_CLOCKTYPE_HCLK;

clockconfig.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK;

clockconfig.AHBCLKDivider=RCC_SYSCLK_DIV1;

clockconfig.APB1CLKDivider=RCC_SYSCLK_DIV1;

clockconfig.APB2CLKDivider=RCC_SYSCLK_DIV1;

HAL_RCC_ClockConfig(&clockconfig,1);

SystemCoreClockUpdate();

but the core clock is still the original value (32Mhz) , i have read that you must change the core clock in an specific order like turn on the HSI, turn off the PLL, reconfigure the PLL, turn on the PLL again , and in other posts says that you only should do what i am doing , this is so confuse.

Posted on April 03, 2018 at 17:30

>>

in other posts says that you only should do what i am doing , this is so confuse.

Think of it like a manual transmission car, you can't jam it through the gears without depressing the clutch, and if you don't match some of the speeds you're going to grind the gears.

The subroutine you call here hides the details. If you plan on changing the settings at a register level you're going to need to be aware of the details. The part is synchronous, so if you stop the clock it is using to run the part everything will stop, so clearly you want to switch to some other working clock first. You can't change the PLL registers when it is running, doing so would result in also sort of odd frequency changes, phase errors, and glitches.

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