/* Wait till HSI is ready and if Time out is reached exit */ //等待内部时钟起振
do
{
HSIStatus = RCC->CR & RCC_CR_HSIRDY;
StartUpCounter++;
} while((HSIStatus== 0) && (StartUpCounter != HSI_STARTUP_TIMEOUT));
/* Wait till PLL is ready *///等待锁相环就绪
while((RCC->CR & RCC_CR_PLLRDY) == 0)
{
}
/* Select PLL as system clock source *///选择锁相环输出时钟作为系统时钟
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
/* Wait till PLL is used as system clock source *///等待锁相环输出时钟已经成为系统时钟
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)
{
}
}
else
{ /* If HSI fails to start-up, the application will have wrong clock
configuration. User can add here some code to deal with this error */