AnsweredAssumed Answered

STM32F103C8 - PLL Ready Flag never sets

Question asked by Bhatnagar.Ankit.001 on May 13, 2016
Latest reply on May 21, 2016 by marley.bob

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.

01.//on boot the system core clock is set
02.//HSI @ 8Mhz. Set this to PLL with PLL source HSI
03.//to get the max sysclock of 64mhz
04. 
05.//ensure hsi is ready
06.while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY)!=SET);
07. 
08.RCC_PLLCmd(DISABLE);
09.RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_16);
10.RCC_PLLCmd(ENABLE);
11. 
12.printf("1");
13.//wait till pll ready
14.while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)!=SET);
15.printf("1");
16. 
17.//configure sysclk to use pll
18.RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
19. 
20.//after changing clocks ALWAYS call this function to update
21.//the system clock variables
22.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?


Outcomes