对于F2/F4,修改晶振频率,一般是在 stm32fxxx_conf.h 中自定义 HSE_VALUE#if defined (HSE_VALUE)
/* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */
#undef HSE_VALUE
#define HSE_VALUE ((uint32_t)8000000)
#endif /* HSE_VALUE */
但在
Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F2xx\system_stm32f2xx.c
Libraries\CMSIS\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c
中,依然是固定的:/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 25
#define PLL_N 240
造成当晶振不为默认值(25M)时需要修改源文件,建议修改为:#define PLL_M (HSE_VALUE / 1000000UL)
|