AnsweredAssumed Answered

Failed to configure the system clock for STM32F103

Question asked by lee.gordon on Sep 13, 2014
Latest reply on Sep 13, 2014 by Clive One

I am trying to create a 64MHz system clock by using the 8MHz HSI clock and the PLL (PLLMUL = 16).  But the firmware stops working after this line:
But it will work if I change the PLLMUL to 13 or less.  The user manual says the STM32F103 system clock max frequency is 72MHz, so I don't know why the firmware fails.

Below is a simple example main.c file, the project was created by Keil uVision 5.1.  Project file attached.
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
#include <stdio.h>
int main(void)
    GPIO_InitTypeDef gpio_init_structure;   //GPIO structure
    RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_16);
    // Enable PLL
  // Checks whether the specified RCC flag is set or not
    // Wait till PLL is ready
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
    // Select PLL as system clock source
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
    /* Output clock on MCO pin ---------------------------------------------*/
    gpio_init_structure.GPIO_Pin = GPIO_Pin_8;
    gpio_init_structure.GPIO_Mode = GPIO_Mode_AF_PP;
    gpio_init_structure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOA, &gpio_init_structure);
    //  RCC_MCOConfig(RCC_MCO_HSE); // Put on MCO pin the: freq. of external crystal
    RCC_MCOConfig(RCC_MCO_SYSCLK);  // Put on MCO pin the: System clock selected 
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
void assert_failed(uint8_t* file, uint32_t line)
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  /* Infinite loop */
  while (1)
  * @}
  * @}
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/