AHB (HCLK) 时钟 = SYSCLK = 72MHz APB2(PCLK2)时钟 = AHB时钟 = 36MHz APB1(PCLK1)时钟 = AHB 1/2时钟 = 72MHz ADC时钟 = PCLK2 1/4 = 9MHz PLL时钟 = HSE*9 = 72MHz ErrorStatus HSEStartUpStatus; //初始化RCC外部设备寄存器 RCC_DeInit(); //打开外部高速晶振 RCC_HSEConfig( RCC_HSE_ON ); //等待外部高速设备准备好 HSEStartUpStatus = RCC_WaitForHSEStartUp(); //外部高速设备已准备好 if( HSEStartUpStatus == SUCCESS ) { //启动FLASH预取值 FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); //设置FLASH_Lacency延时2周期 FLASH_SetLatency(FLASH_Latency_2); //配置AHB(HCLK)时钟=SYSCLK RCC_HCLKConfig(RCC_SYSCLK_Div1); //配置APB2(PCLK2)钟=AHB时钟 RCC_PCLK1Config(RCC_HCLK_Div2); //配置APB1(PCLK1)钟=AHB 1/2时钟 RCC_PCLK2Config(RCC_HCLK_Div1); //配置ADC时钟=PCLK2 1/4 RCC_ADCCLKConfig(RCC_PCLK2_Div4); //配置PLL时钟 == 外部高速晶体时钟*9 RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9); //使能PLL RCC_PLLCmd(ENABLE); //等待PLL时钟就绪 while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)==RESET) { } //SYSCLK = PLL RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); //检查PLL时钟是否为SYSCLK while(RCC_GetSYSCLKSource() != 0x08) { } }
stm32 时钟 pcclk ahb hclk
最新推荐文章于 2024-07-15 14:35:22 发布