STM32芯片时钟配置
对STM32进行软件开发时,最基本的就是对STM32芯片进行时钟和端口配置,然后是对项目所用到的片上资源进行配置并驱动,下面给出时钟和端口配置代码,该代码几乎涵盖了片上所有时钟和端口配置项目,可根据自己需要进行删除不必要的配置项:
/******************************************************************
* Function Name : RCC_Configuration 复位时钟控制配置
* Description : Configures the different system clocks.
* Input : None
* Output : None
* Return : None
*******************************************************************/
void RCC_Configuration(void)
{
/* system clocks configuration -----系统时钟配置----*/
/* RCC system reset(for debug purpose) */
RCC_DeInit(); //将外设RCC寄存器重设为缺省值
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON); //开启外部高速晶振(HSE)
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp(); //等待HSE起振
if(HSEStartUpStatus == SUCCESS) //若成功起振,(下面为系统总线时钟设置) {
/* Enable Prefetch Buffer */


