cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405 PLL: 168MHz to 84MHz - how to do this?

Rogers.Gary
Senior II
Posted on July 08, 2015 at 05:07

Hello:

I have an STM32F405 processor, with a 8MHz HSE crystal. It's set up to operate at 168MHz. To see if I can get suitable performance at a lower speed to save power, I'd like to change this (*not* on the fly) at the program start to 84MHz.

Is this done by changing the HSE value? It cannot be that simple...as I understand it, the HSE value must match the actual crystal frequency.

Thank you...

12 REPLIES 12
Posted on July 10, 2015 at 05:43

#if defined (PLL_SOURCE_HSI)
uint32_t SystemCoreClock = (((HSI_VALUE / PLL_M )* PLL_N) / PLL_P);
#else
uint32_t SystemCoreClock = (((HSE_VALUE / PLL_M )* PLL_N) / PLL_P);
#endif

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Rogers.Gary
Senior II
Posted on July 10, 2015 at 06:34

much better than hard coding the value...thanks clive1

Rogers.Gary
Senior II
Posted on July 10, 2015 at 06:52

interesting....I did have to update the firmware to get it working in the ST-Link utility.

but still was not working in IAR's terminal window. After downloading to the target, I clicked the ''ST Link'' tab in the IAR menu, and opened up SWO Configuration. For some reason, after changing the clock speed, it disabled ''SWO Force Trace Window Sampling''.  After re-enabling it, all is well. Printf is back with the ST-Link pod. $$$ will be saved.

Will buy you a beer clive1.

Thanks!