cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F401CC cannot use PLL as System Clock Source

vipin
Associate II
Posted on June 17, 2014 at 19:27

Hi,

I would like to run the processor system clock using the system clock (PLL @ 84MHz). However, this is not working. As soon as I enable the PLL clock to be used as the system clock, the MCU goes to the Hard Fault Handler. I have attached my system_init() code.

Thanks,

Vipin

6 REPLIES 6
Posted on June 17, 2014 at 21:16

You had better have selected the slower flash wait states BEFORE engaging the faster clock. Otherwise the processor will read junk and crash.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vipin
Associate II
Posted on June 17, 2014 at 22:54

Hi Clive,

Thank you for your quick response. May I know what you would define as a slow flash read time for an 84MHz PLL clock?

Thanks,

Vipin

vipin
Associate II
Posted on June 17, 2014 at 23:04

Thank you Clive. I moved my FLASH WS initialization before my PLL setup and my system is up and running.

Thank you,

Vipin

vipin
Associate II
Posted on June 18, 2014 at 22:34

Hi again,

Unfortunately I was not able to run the fix on the STM32F401CC. However, the same code does run on the STM32F407. Are there any tips or trick to get the same code running on the 401CC. As far as I understand, it is the same architecture with lower flash and RAM.

Is there a startup script that can also be perhaps looked at for the 401? I was not able to find one online.

Thanks,

Vipin

Posted on June 19, 2014 at 01:37

STM32F401-Discovery_FW_V1.0.0\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm\startup_stm32f401xx.s

STM32F401-Discovery_FW_V1.0.0\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c Project define - STM32F401xx

#if defined (STM32F401xx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 4
#endif /* STM32F401xx */

Make sure HSE_VALUE and the PLL source settings match the HSE clock crystal on your board.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vipin
Associate II
Posted on June 20, 2014 at 02:11

Hi again,

Thanks for the response. I found my error: I was enabling some peripherals before this init which was breaking the system.

Thanks again,

Vipin