外接晶振25M,假如要将系统时钟设为168Mhz
打开 system_stm32f4xx.c文件
/************************* PLL Parameters *************************************/
#if defined (STM32F40_41xxx) || defined (STM32F427_437xx) || defined (STM32F429_439xx) || defined (STM32F401xx)
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 25
#else /* STM32F411xE */
#if defined (USE_HSE_BYPASS)
#define PLL_M 8
#else /* STM32F411xE */
#define PLL_M 16
#endif /* USE_HSE_BYPASS */
#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F401xx */
把 #define PLL_M 改为 25
#if defined (STM32F40_41xxx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F40_41xxx */
那么PLL=25Mhz*PLL_N /(PLL_M / PLL_P )=25*336/(25*2)=168Mhz
如果外接晶振8M,假如要将系统时钟设为168Mhz
PLL_M =8, PLL_N = 336;PLL_P= 2
那么PLL=8*336/(8*2)=168Mhz
* Supported STM32F40xxx/41xxx devices
*-----------------------------------------------------------------------------
* System Clock source | PLL (HSE)
*-----------------------------------------------------------------------------
* SYSCLK(Hz) | 168000000
*-----------------------------------------------------------------------------
* HCLK(Hz) | 168000000
*-----------------------------------------------------------------------------
* AHB Prescaler | 1
*-----------------------------------------------------------------------------
* APB1 Prescaler | 4
*-----------------------------------------------------------------------------
* APB2 Prescaler | 2
*-----------------------------------------------------------------------------
* HSE Frequency(Hz) | 25000000
*-----------------------------------------------------------------------------
* PLL_M | 25
*-----------------------------------------------------------------------------
* PLL_N | 336
*-----------------------------------------------------------------------------
* PLL_P | 2
*-----------------------------------------------------------------------------
* PLL_Q | 7
*-----------------------------------------------------------------------------
* PLLI2S_N | NA
*-----------------------------------------------------------------------------
* PLLI2S_R | NA
*-----------------------------------------------------------------------------
* I2S input clock | NA
*-----------------------------------------------------------------------------
* VDD(V) | 3.3
*-----------------------------------------------------------------------------
* Main regulator output voltage | Scale1 mode
*-----------------------------------------------------------------------------
* Flash Latency(WS) | 5
*-----------------------------------------------------------------------------
* Prefetch Buffer | ON
*-----------------------------------------------------------------------------
* Instruction cache | ON
*-----------------------------------------------------------------------------
* Data cache | ON
*-----------------------------------------------------------------------------
* Require 48MHz for USB OTG FS, | Disabled
* SDIO and RNG clock |
*----------------------------------------------------------------------------
还有stm32f4xx.h中的宏定义标识符,约123行,此处要和硬件就是晶振的频率相同
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
上一篇:STM32F407时钟设置
下一篇:STM32F103和F407时钟频率
推荐阅读最新更新时间:2024-11-06 01:59
设计资源 培训 开发板 精华推荐
- LM2902VDTBR2G 维恩桥振荡器运算放大器的典型应用
- ZXLD1371EV6,基于 ZXLD1371 LED 驱动器的评估板
- LTC3230 演示板,具有双 LDO 的 5-LED 主/副显示驱动器
- L4972A 的典型应用电路,1A/24V 多电源,注意 L4972A 和 L4962 之间的同步
- ADR3433 3.3V 输出微功率、高精度电压基准的典型应用
- FAN53610 同步降压转换器的典型应用
- DER-672 - 使用 HiperLCS-2 芯片组和 HiperPFS-5 的 220 W 功率因数校正 LLC 电源,适用于电视和显示器
- LTC2261-14 演示板,14 位,125Msps ADC,LVDS 输出,5-170MHz
- 用于线路瞬态响应的 LR8 高输入电压线性稳压器的典型应用
- MCP16331 高压输入集成开关降压稳压器电路(12V 输入、2V 输出、500 mA)下的典型应用