//48mhz时钟 ppl
void HSI_SYS(void){
//选HSI48 or HSI,让系统先起来
//RCM_ConfigSYSCLK(RCM_SYSCLK_SEL_HSI48);
RCM_ConfigSYSCLK(RCM_SYSCLK_SEL_HSI);
//选PPL
/* Disable PLL */
RCM_DisablePLL();
/* Wait until Pll is ready */
while (RCM->CTRL1_B.PLLRDY** == SET);
/* Config PLL source and multiplication factor
SYSCLKFreq = (HSI48 * 2) / 2 */
RCM_ConfigPLL(RCM_PLL_SEL_HSI, RCM_PLLMF_12);
RCM_ConfigCLKDIV(RCM_CLK_DIV_2);
while (RCM->CTRL1_B.PLLRDY** == SET);
/* Enable PLL */
RCM_EnablePLL();
/* Selct PLL as Sysclk */
RCM_ConfigSYSCLK(RCM_SYSCLK_SEL_PLL);
sysclk=RCM_ReadSYSCLKFreq();//读系统时钟
} |