stm32- clock system

Clock tree
    STM32 take multiple clock providing clock signals depending on the different peripheral
STM32 five clock sources: the HSI | the HSE | the LSI | the LSE | the PLL
the LSI
    speed internal RC oscillator is 32KHZ clock frequency is not very stable, the main to an independent watchdog for use, because the frequency of the watchdog requirements are not particularly critical, also as RTC clock source. RTC clock may also be provided by the HSE. (RTC while LSEOSC used as a clock source, since the frequency LSEOSC more accurate, and therefore often used LSEOSC RTC clock source as)
the LSE low-speed external clock
HSE high-speed external clock
HSI system clock source as
any peripheral prior to use, must first can their respective clock
frequency f / M * N / P is PLLI2SCLK
the PLL 8MHZ * = N / (N * P) = 8MHZ * 336 / (2 *. 8) = 168MHz
MCO1, MCO2 pin, the internal clock to the chip corresponding to chip pin PA8, PA9
    MCO1 output HSI | LSE | HSE | PLL clock source
    MCO2 may output the HSE | the PLL | the SYSCLK | PLLI2SCLK
MCO does not exceed the maximum output clock 100MHZ

system clock as a direct Ethernet clock PTP

CR registers are generally used for clock source enable high-speed internal clock enable
PLLCFGR clock tree configuration register M, Q, R, N specific values
CFGR number register is used to select the division ratio or AHB1 clock source
AHB1 | AHB2 | AHB3 register


stm32f4xx_rcc.c | stm32f4xx_rcc.h clock enable file

clock enable configuration:
    RCC_HSICmd, RCC_LSICmd, RCC_PLLCmd, RCC_PLLI2SCmd, RCC_PLLSAICmd, RCC_RTCCLKCmd, RCC_AHBxPeriphClockCmd
    RCC_APBxPeriphClockCmd

clock source and configuration:
    RCC_HSEConfig, RCC_LSEConfig, RCC_PLLConfig, RCC_PLLI2SConfig , RCC_PLLSAIConfig, RCC_MCO1Config, RCC_MCO2Config, RCC_SYSCLKConfig , RCC_HCLKConfig, RCC_PCLK1Config, RCC_PCLK2Config, RCC_RTCCLKConfig, RCC_I2SCLKConfig

peripheral reset function
    RCC_AHB1PeriphResetCmd, RCC_AHB2PeriphResetCmd, RCC_AHB3PeriphResetCmd, RCC_APB1PeriphResetCmd, RCC_APB2PeriphResetCmd

state parameter acquisition parameters:
    RCC_GetSYSCLKSource, RCC_GetClocksFreq, RCC_GetFlagStatus, RCC_ClearFlag

RCC interrupt related functions:
    RCC_ITConfig, RCC_ClearITPendingBit, RCC_GetITStatus

default system clock initialization SystemInit disposed inside, which is disposed to direct operation register

Guess you like

Origin www.cnblogs.com/sailorwithoutsea/p/12395604.html