Because the STM project uses the firmware library, the clock has been configured when entering the main function, so we need to reset the RCC register first when we write the clock configuration file ourselves!
Enable HSE
Determine whether HSE is successfully started
enable prefetch
Set the FLASH wait period
Configure the multipliers of the 3 buses
Configure the phase-locked loop, enable the phase-locked loop
Wait for the PLL to stabilize
Select the PLL output as the system clock and wait for it to stabilize
Because the STM project uses the firmware library, the clock has been configured when entering the main function, so we need to reset the RCC register first when we write the clock configuration file ourselves!
Enable HSI
Determine whether the HSI is successfully started
enable prefetch
Set the FLASH wait period
Configure the multipliers of the 3 buses
Configure the phase-locked loop, enable the phase-locked loop
Wait for the PLL to stabilize
Select the PLL output as the system clock and wait for it to stabilize