Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1233
  • 博文数量: 1
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2017-10-13 10:41
文章分类
文章存档

2017年(1)

我的朋友
最近访客

分类: 嵌入式

2017-10-14 12:41:12

转载:http://sxy050819.blog.163.com/blog/static/887632232013324104759747/
学习野火的固件库UART1串口案例时,用的是SIM9008模块应用板上的STM32103F103RB芯片,使用的外部晶振是12M。
串口读取的是乱码 
默认的外部晶振是8M
由于stm32的库默认是外部晶振8M的情况下实现的,所以配置串口波特率的时候也是按8M,包括主频。

如果采用外部晶振8M或12M,配置时钟为72MHZ 。
1)在system32_stm32f10x.c文件中的void SetSysClockTo72(void)里这样改:
8M:
RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL9);//8*9=72
12M:
RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL6);//12*6=72

2)stm32f10x.h中修改:
8M:
#define HSE_Value ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */ 
12M:
#define HSE_Value ((uint32_t)12000000) /*!< Value of the External oscillator in Hz */

阅读(162) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~