相关文章
环境
-
STM32F407VET6 开发板(魔女),http://www.stm32er.com/
-
Keil MDK5,版本 5.36
串口驱动
-
RT-Thread 通过适配 串口驱动,可以使用 MSH shell
-
当前手动搭建的 BSP 来自
rt-thread\bsp\stm32\stm32f407-st-discovery
,烧写后,发现串口没有任何数据输出,初步认为引脚配置问题,因为MSH 串口 msh 配置的都是uart1

串口 uart1 引脚
-
魔女 STM32F407VET6开发板 uart1 引脚是常用的
PA9 PA10
,而rt-thread\bsp\stm32\stm32f407-st-discovery
默认配置的是PB6 PB7
-
通过 STM32CubeMX 修改 串口 uart1 引脚,更新
stm32f407\stm32f407-st-discovery\board\CubeMX_Config\Src\stm32f4xx_hal_msp.c
-
双击或者通过STM32CubeMX 打开
stm32f407\stm32f407-st-discovery\board\CubeMX_Config\CubeMX_Config.ioc


- 保存并生成代码,发现 串口相关驱动更改了


更新
- 串口引脚配置后编译并下载,发现串口正常工作了

小结
-
本篇通过借助
STM32CubeMX
修改 串口 uart1 的引脚配置,正确适配 RT-Thread 串口 MSH 终端,这样就可以使用 RT-Thread MSH 串口命令了 -
如果串口没有输出,首先需要根据硬件原理图,确认配置的串口引脚是否正确