cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8 - PLL Ready Flag never sets

ankitmcgill
Associate II
Posted on May 13, 2016 at 06:55

I am trying to set PLL as my system clock source upon startup of my microcontroller, STM32f103

I have commented all the defines in my system_stm32f10x.c

1.

white-space: inherit;''>

/* #define SYSCLK_FREQ_HSE HSE_VALUE */

2.

/* #define SYSCLK_FREQ_24MHz 24000000 */

3.

/* #define SYSCLK_FREQ_36MHz 36000000 */

4.

/* #define SYSCLK_FREQ_48MHz 48000000 */

5.

/* #define SYSCLK_FREQ_56MHz 56000000 */

6.

/*#define SYSCLK_FREQ_72MHz 72000000*/

So my system starts with hsi(8Mhz) as the clock source. This I have verified to be working just fine. However when I try to initialize pll to set it as the clock source, the PLL Ready flag never sets.

//on boot the system core clock is set

//HSI @ 8Mhz. Set this to PLL with PLL source HSI

//to get the max sysclock of 64mhz

//ensure hsi is ready

while

(RCC_GetFlagStatus(RCC_FLAG_HSIRDY)!=SET);

RCC_PLLCmd(DISABLE);

RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_16);

RCC_PLLCmd(ENABLE);

printf(

''1''

);

//wait till pll ready

while

(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)!=SET);

printf(

''1''

);

//configure sysclk to use pll

RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

//after changing clocks ALWAYS call this function to update

//the system clock variables

SystemCoreClockUpdate();

When I debug my code, I only get '1' in my debug output window which means the pll ready flag never sets.I have tried with lower pll multiplication factor with same result.

Any idea what could be going wrong here?

1 REPLY 1
oeliks
Senior
Posted on May 21, 2016 at 14:51