STM32F407-RCC配置 联系客服

发布时间 : 星期日 文章STM32F407-RCC配置更新完毕开始阅读3c11ec1925c52cc58bd6bed8

建议选择 2MHz 来限制PLL震荡(jitter?)

* @param PLLN: specifies the multiplication factor for PLL VCO output clock * This parameter must be a number between 192 and 432.

@参数 PLLN 选择 PLL VCO输出时钟的 乘法因子(multiplication factor ) 这个参数的值 介于 192 ~432

* @note You have to set the PLLN parameter correctly to ensure that the VCO * output frequency is between 192 and 432 MHz.

* @注意 你学要正确选PLLN的大小,以保证VCO输出时钟介于 192 ~432MHz * @param PLLP: specifies the division factor for main system clock (SYSCLK) * This parameter must be a number in the range {2, 4, 6, or 8}.

@参数 PLLP 选择 系统时钟SYSCLK 的除法因子(division factor ),这个 值可以是2,4,6,8

* @note You have to set the PLLP parameter correctly to not exceed 168 MHz on * the System clock frequency.

* @注意 你需要正确设置PLLP,确保系统时钟SYSCLK不超过168MHz * @param PLLQ: specifies the division factor for OTG FS, SDIO and RNG clocks * This parameter must be a number between 4 and 15.

@参数 PLLQ 选择给 OTG FS(USB), SDIO(SD卡读写), RNG(随机数发生器) 时钟的除法因子,其值介于4~15

* @note If the USB OTG FS is used in your application, you have to set the * PLLQ parameter correctly to have 48 MHz clock for the USB. However, * the SDIO and RNG need a frequency lower than or equal to 48 MHz to work * correctly.

* @注意 如果在你的程序中用到 USB OTG FS,你需要正确设置PLLQ,确保USB有 */

void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP, uint32_t PLLQ) {

/* Check the parameters */

assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource)); assert_param(IS_RCC_PLLM_VALUE(PLLM)); assert_param(IS_RCC_PLLN_VALUE(PLLN)); assert_param(IS_RCC_PLLP_VALUE(PLLP)); assert_param(IS_RCC_PLLQ_VALUE(PLLQ));

RCC->PLLCFGR = PLLM | (PLLN << 6) | (((PLLP >> 1) -1) << 16) | (RCC_PLLSource) | (PLLQ << 24); }

48MHz的时钟。但是对于SDIO,RNG需要一个小于或等于48MHz的时钟

* @retval None

下面介绍:

void RCC_AHB1PeriphClockCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState); void RCC_AHB2PeriphClockCmd(uint32_t RCC_AHB2Periph, FunctionalState NewState); void RCC_AHB3PeriphClockCmd(uint32_t RCC_AHB3Periph, FunctionalState NewState); void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState); void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);

这些函数在STM32F407上的使用 和 在STM32F103只有一小部分区别, 例如:

在STM32F103用 RCC_APB1PeriphClockCmd() 使能 GPIO时钟, 而在STM32F407中,使用 RCC_AHB1PeriphClockCmd()进行使能。 还有一些类似的变化这不一一介绍了,请直接参考库函数文件。