void RCC_Configuration(void)
{
ErrorStatus HSEStartUpStatus;
RCC_DeInit(); //
//RCC_HSEConfig(RCC_HSE_OFF); //¹Ø±ÕHSEʱÖÓ
RCC_HSICmd(ENABLE); //ʹÄÜHSIʱÖÓ
while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET) //µÈ´ýHSIʱÖÓÎȶ¨
{
}
FLASH_PrefetchBufferCmd(ENABLE); //¿ªÆôFLASHÔ¤¶Á»»³å¹¦ÄÜ£¬¼ÓËÙFLASHµÄ¶ÁÈ¡
FLASH_SetLatency(FLASH_Latency_1); //FLASHʱÐòÑÓ³Ù1¸öÖÜÆÚ£¬µÈ´ý×ÜÏßͬ²½²Ù×÷
RCC_HCLKConfig(RCC_SYSCLK_Div1); //AHB = SYSCLK 16M
RCC_PCLK1Config(RCC_HCLK_Div1); //APB1 = 16M
RCC_PCLK2Config(RCC_HCLK_Div1); //APB2 = 16M
RCC_PLLConfig(RCC_PLLSource_HSI, RCC_PLLMul_4,RCC_PLLDiv_4); //HSI×öΪPLLʱÖÓ3±¶Æµ£¬2·ÖƵ
RCC_PLLCmd(ENABLE); //ʹÄÜPLLʱÖÓ
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) //µÈ´ýPLLÎȶ¨
{
}
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); //Ñ¡ÓÃPLLʱÖÓΪϵͳʱÖÓ
//
while(temp != 0x0C) //µÈ´ýʱÖÓÎȶ¨
{
temp=RCC_GetSYSCLKSource();
}
只有在RCC_PLLConfig(RCC_PLLSource_HSI, RCC_PLLMul_4,RCC_PLLDiv_4);的时候不跑飞,还老是进入HardFault_Handler |