本帖最后由 pentral0311 于 2013-1-28 15:19 编辑
STM32F207 时钟配置 问题
我配置的时钟文件如下,外部晶振是8M
void RCC_Configuration(void)
{
ErrorStatus HSEStartUpStatus;
RCC_ClocksTypeDef RCC_ClocksStatus;
/* RCC system reset(for debug purpose) */
RCC_DeInit();
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS)
{
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(ENABLE);
/*000b Zero wait state, if 0 < SYSCLK≤ 24 MHz
001b One wait state, if 24 MHz < SYSCLK ≤ 48 MHz
010b Two wait states, if 48 MHz < SYSCLK ≤ 72 MHz*/
/* Flash 1 wait state */
FLASH_SetLatency(FLASH_Latency_1);
/* DISABLE PLL */
RCC_PLLCmd(DISABLE);
/* Select PLL as system clock source */
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK1 = HCLK / 4 */
RCC_PCLK1Config(RCC_HCLK_Div4);
/* PCLK2 = HCLK / 2 */
RCC_PCLK2Config(RCC_HCLK_Div2);
// /* ADCCLK = PCLK2 / 4 */
// RCC_ADCCLKConfig(RCC_PCLK2_Div4);
/*这里是我下载了官方F2系列 时钟配置文件 ,参考此文件做的 RCC_PLLSource_HSE = 8M*/ /* PLLCLK = (RCC_PLLSource_HSE/8) * 192/2 = 96 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE,8,192,2,8);
/* Enable PLL */
RCC_PLLCmd(ENABLE);
/* Wait till PLL is ready */
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
/* Wait till PLL is used as system clock source */
while(RCC_GetSYSCLKSource() != 0x08)
{
}
/* Get Clock */
RCC_GetClocksFreq(&RCC_ClocksStatus);
// /* unused GPIO pins set to analog-input mode to improve EMC */
// GPIO_AIM_Init(1);
}
// SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);//使用与系统同样的
// SysTick_SetReload(0xffffff); //以最大开始重新装载
}
而我实际得到的是300M,附件里面有我读到的时钟值 不知道是哪里出错,望指点一二!!!
|