STM32F051R8T6的RCC配置
* OSC=8M
* PLLCLK=48M
* SYSCLK=48M
* HCLK=48M
*/
void RCC_Configuration(void)
{
ErrorStatus HSEStartUpStatus;
RCC_DeInit();
RCC_HSEConfig(RCC_HSE_ON); //RCC_HSE_ON--HSE晶振打开(ON)
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS) //SUCCESS:HSE晶振稳定且就绪
{
FLASH_SetLatency(FLASH_Latency_1); //FLASH_Latency_1 1延时周期
FLASH_PrefetchBufferCmd(ENABLE); // 预取指缓存使能
/* PLL configuration: pllclk= HSE * 6 = 48 MHz */
RCC_PREdiv1Config(RCC_PREdiv1_Div1);
RCC_PLLConfig(RCC_PLLSource_PREdiv1, RCC_PLLMul_6);
RCC_HCLKConfig(RCC_SYSCLK_Div1); //RCC_SYSCLK_Div1--AHB时钟 HCLK= SYSCLK(48)系统时钟
RCC_PCLKConfig(RCC_HCLK_Div1); //PCLK = HCLK = 48
RCC_PLLCmd(ENABLE);
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET){}
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); //选择PLL作为sysclk系统时钟 SYSCLK = PLLCLK
while(RCC_GetSYSCLKSource() != 0x08){} //等待系统时钟设置成功 0x08:PLL作为系统时钟
}
}
STM32F051R8T6RCC配 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)