zoukankan      html  css  js  c++  java
  • HSE_VALUE 修改问题

    MDK的例程给的外部晶振是25Mhz,以24Mhz为例,介绍修改方法。

    ·1. 修改HSE_VALUE

    在 “stm32f4xx.h" 搜索 ”HSE_VALUE" 会看到下面这句话:

    #if !defined  (USE_STDPERIPH_DRIVER)
    /**
     * @brief Comment the line below if you will not use the peripherals drivers.
       In this case, these drivers will not be included and the application code will 
       be based on direct access to peripherals registers 
       */
      /*#define USE_STDPERIPH_DRIVER */
    #endif /* USE_STDPERIPH_DRIVER */
    
    /**
     * @brief In the following line adjust the value of External High Speed oscillator (HSE)
       used in your application 
       
       Tip: To avoid modifying this file each time you need to use different HSE, you
            can define the HSE value in your toolchain compiler preprocessor.
      */           
    
    #if !defined  (HSE_VALUE) 
      #define HSE_VALUE    ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */
      
    #endif /* HSE_VALUE */

     意思说不用修改这里的HSE_VALUE,可以使用预编译工具来修改,但是MDK添加 HSE_VALUE的预编译还行,添加值我不会。

    要命的是,这里的“stm32f4xx.h"是受保护的不允许修改,好在,后面有个配置的头文件:

    搜索"#include",你会看到:

    #ifdef USE_STDPERIPH_DRIVER
      #include "stm32f4xx_conf.h"
    #endif /* USE_STDPERIPH_DRIVER */

    打开 "stm32f4xx_conf.h"文件,添加HSE_VLAUE的定义即可。

    /* Define to prevent recursive inclusion -------------------------------------*/
    #ifndef __STM32F4xx_CONF_H
    #define __STM32F4xx_CONF_H
    
    #undef HSE_VALUE
    #define HSE_VALUE    ((uint32_t)24000000) /*!< Value of the External oscillator in Hz */
    
    /* Includes ------------------------------------------------------------------*/
    /* Uncomment the line below to enable peripheral header file inclusion */
    #include "RTE_Components.h"

     你以为完了吗,没有!!!

    2. 修改PLL_M

    打开文件 "system_stm32f4xx.c" ,搜索”PLL_M", 将其修改为24:

    /************************* PLL Parameters *************************************/
    /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
    #define PLL_M      24

     (END)

  • 相关阅读:
    允许使用root远程ssh登录(Ubuntu 16.04)
    Nginx反向代理,负载均衡,redis session共享,keepalived高可用
    Spring MVC框架:第十六章:细节了解
    Spring MVC框架:第十五章:多IOC容器整合
    Spring MVC框架:第十四章:数据校验
    Spring MVC框架:第十三章:类型转换
    Spring MVC框架:第十二章:运行原理
    Spring MVC框架:第十一章:Ajax
    Spring MVC框架:第九章:文件上传
    Spring MVC框架:第十章:拦截器
  • 原文地址:https://www.cnblogs.com/qiyuexin/p/8410947.html
Copyright © 2011-2022 走看看