STM32时钟系统


这里写图片描述
这里写图片描述
对外时钟:在使用外设之前必须使能时钟
APB1 Prescaler 最大36mhz
APB2 Prescaler 最大72mhz
时钟相关配置在stm32f10x_rcc.h
typedef struct
{
__IO uint32_t CR; //常用
__IO uint32_t CFGR; //常用时钟源选择 分频系数设定
__IO uint32_t CIR;
__IO uint32_t APB2RSTR;
__IO uint32_t APB1RSTR;
__IO uint32_t AHBENR; //常用 DMA ,SDIO
__IO uint32_t APB2ENR; //常用APB2线上外设时钟
__IO uint32_t APB1ENR; //常用APB1线上外设时钟
__IO uint32_t BDCR;
__IO uint32_t CSR;
} RCC_TypeDef;

使能后不稳定,等待稳定(就绪标志位为1)
1.时钟使能配置:
RCC_LSEConfig() 、RCC_HSEConfig()、
RCC_HSICmd() 、 RCC_LSICmd() 、 RCC_PLLCmd() ……

2.时钟源相关配置:
RCC_PLLConfig ()、 RCC_SYSCLKConfig() 、
RCC_RTCCLKConfig() …

3.分频系数选择配置:
RCC_HCLKConfig() 、 RCC_PCLK1Config() 、 RCC_PCLK2Config()…

4.外设时钟使能:
RCC_APB1PeriphClockCmd(): //APB1线上外设时钟使能
RCC_APB2PeriphClockCmd(); //APB2线上外设时钟使能
RCC_AHBPeriphClockCmd(); //AHB线上外设时钟使能

  1. 其他外设时钟配置:
    RCC_ADCCLKConfig (); RCC_RTCCLKConfig();

6.状态参数获取参数:
RCC_GetClocksFreq();
RCC_GetSYSCLKSource();
RCC_GetFlagStatus()
7.RCC中断相关函数 :
RCC_ITConfig() 、 RCC_GetITStatus() 、 RCC_ClearITPendingBit()…

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章