one. Explanation of clock system block diagram
1. 5 clock sources of STM32
a. High-speed internal clock HSI, about 8MHz
b. High-speed external clock HSE, the crystal oscillator value range is 4M--16M, generally 8M crystal oscillator is used
c. Low-speed external clock LSE, 32.768k crystal oscillator, can be used as the clock source of RTC
d. Low-speed internal clock LSI, about 40KHz
e. PLL phase locked loop clock
2. System Clock
3 sources of system clock SYSCLK
a. HSI
b. HSE
c. PLL
3. RTC clock source
a. LSE
b. LSI
c. 128 frequency division of LSE
4. Independent watchdog IWDGCLK clock source
LSI
5. The source of the USB clock USBCLK
The maximum frequency is 48MHz
The PLL is divided by 1 or 1.5 through the prescaler
6. The internal clock output MCO, which is a pin PA8 of the STM32 chip
a. SYSCLK
b. HSI
c. HSE
d. PLL clock divided by 2
7. APB1 bus clock, up to 36M
8. APB2 bus clock, up to 72M
APB, APB1, APB2 provide clock for peripherals
All clocks have clock enable and peripherals can only be used when the clock is on.
Configuration of the clock
See "STM32 Chinese Reference Manual"
three. System clock system initialization important functions
SystemInit();
Its function is to initialize the system clock and initialize the system clock to a default state. This function will be called automatically after the system is started.
In the startup_stm32f10x_hd.s file:
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT __main
IMPORT SystemInit
LDR R0, =SystemInit //Execute the SystemInit() function first
BLX R0
LDR R0, =__main //execute the main() function again
BX R0
ENDP
This function defines the system clock as 72MHz by default
#define SYSCLK_FREQ_72MHz 72000000
The state of the system after initialization:
SYSCLK 72MHz
AHB 72MHz
PCLK1 36MHz
PCLK2 72MHz
PLL 72MHz
Four. System clock configuration call function
RCC_HSE_ConfiguraTIon();
Note: When enabling any clock, wait for the clock to stabilize before continuing.
RF Coaxial Connector,RF QMA Connector,RF FME Coaxial Cable Connector,Wire Solder Type RF Connectors
Xi'an KNT Scien-tech Co., Ltd , https://www.honorconnector.com