今天(2014.4.21)把stm32f107的程序下载到stm32f103的板子上,发现串口收不到数据,突然想起晶振频率没有修改,#define HSE_VALUE    ((uint32_t)13560000) /*!< Value of the External oscillator in Hz */ 这个要改回去,因为外接晶振是8M

之后试验,发现有数据,但是乱码。百思不得其解,无意中发现,PC的波特率设置为9600,板子的波特率设置为19200就不会乱码。刚好是2倍的关系。顺藤摸瓜问度娘!一个帖子也是这种情况,一个回答是“问题解决了,把target options里#define里的STM32F10X_HD_VL改成STM32F10X_MD就正常了(我用的是中密度器件)”,楼下有人说:

看库里面的stm32f10x.h文件,里面很多内容与系统时钟的配置有关。该文件会根据选择的芯片类型来进行时钟配置,要在此位置将选用的芯片类型去掉注释符。当然不想每次修改此文件,比较方便的方法就是你所说是在编译器的target options选项框中define。。。效果一样。





我翻开那个头文件

#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL) 

  /* #define STM32F10X_LD */     /*!< STM32F10X_LD: STM32 Low density devices */

  /* #define STM32F10X_LD_VL */  /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */  

   /*#define STM32F10X_MD */    /*!< STM32F10X_MD: STM32 Medium density devices */

  /* #define STM32F10X_MD_VL */  /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */  

  /* #define STM32F10X_HD */     /*!< STM32F10X_HD: STM32 High density devices */

  /* #define STM32F10X_HD_VL */  /*!< STM32F10X_HD_VL: STM32 High density value line devices */  

  /* #define STM32F10X_XL */     /*!< STM32F10X_XL: STM32 XL-density devices */

  /* #define STM32F10X_CL */     /*!< STM32F10X_CL: STM32 Connectivity line devices */

#endif

/*  Tip: To avoid modifying this file each time you need to switch between these

        devices, you can define the device in your toolchain compiler preprocessor.

 - Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers

   where the Flash memory density ranges between 16 and 32 Kbytes.

 - Low-density value line devices are STM32F100xx microcontrollers where the Flash

   memory density ranges between 16 and 32 Kbytes.

 - Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers

   where the Flash memory density ranges between 64 and 128 Kbytes.

 - Medium-density value line devices are STM32F100xx microcontrollers where the 

   Flash memory density ranges between 64 and 128 Kbytes.   

 - High-density devices are STM32F101xx and STM32F103xx microcontrollers where

   the Flash memory density ranges between 256 and 512 Kbytes.

 - High-density value line devices are STM32F100xx microcontrollers where the 

   Flash memory density ranges between 256 and 512 Kbytes.   - XL-density devices are STM32F101xx and STM32F103xx microcontrollers where

   the Flash memory density ranges between 512 and 1024 Kbytes.

 - Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers.

  */





似乎有了思路。查找工程代码,定义了#define STM32F10X_MD_VL,(好像上一位工程师写错了),我修改为#define STM32F10X_MD,问题解决。

最新文章

  1. 帝国备份王(Empirebak) \class\functions.php、\class\combakfun.php GETSHELL vul
  2. FZU 2213 Common Tangents(公切线)
  3. hdu5787(数位dp)
  4. flex+java将数据库里的数据导出到指定目录下excel表里(poi)
  5. hdu 4618(最大回文子矩阵)
  6. Read / Write Excel file in Java using Apache POI
  7. 转:FIFO的定义与作用
  8. Css 外边距折叠(collapsed margin ) 浅析
  9. Windows Azure 安全最佳实践 - 第 4 部分:需要采取的其他措施
  10. 成为JAVA软件开发工程师要学哪些东西
  11. 《JAVA与模式》之命令模式
  12. 执行sql时出现错误 extraneous input &#39;;&#39; expecting EOF near &#39;&lt;EOF&gt;&#39;
  13. jquery 倒计时效果
  14. 数据库MySQL5.7.21win64位安装配置
  15. Spring Boot配置文件详解
  16. 《LINQ技术详解C#》-2.查询表达式翻译为标准查询操作符
  17. Levenshtein Distance,判断字符串的相似性
  18. Activiti 5.1.4最佳实践
  19. CSU 1804 - 有向无环图 - [(类似于)树形DP]
  20. 《剑指offer》第十三题(机器人的运动范围)

热门文章

  1. 2014年第五届蓝桥杯省赛试题(JavaA组)
  2. hadoop下HDFS基本命令使用
  3. UINavigationController + UIScrollView组合,视图尺寸的设置探秘(三)
  4. thinkphp 连接数据库 &amp; 实例化模型操作 (下接thinkphp CURD 操作)/慕课
  5. server2008 IIS7配置全过程(包括发布ASP网站)
  6. 【转】oracle远程导入数据库
  7. linux硬盘IO优化相关资料整理
  8. 对状压dp的见解
  9. 实验吧之Canon
  10. 使用nexus 搭建本地 maven 服务器