thereborn000 发表于 2019-4-17 11:33:54

串口调试出不来

本帖最后由 thereborn000 于 2019-4-17 11:37 编辑

我现在使用UWB测距 stm32f107和dw100.程序已经写好了,串口调试出不来结果,想问问是什么原因?
重定向

打印函数,本来是LCD显示,我改了一下




串口引脚配置

串口调试助手没结果


toofree 发表于 2019-4-17 11:33:55

本帖最后由 toofree 于 2019-4-17 12:34 编辑

USART1的管脚设置有问题,默认是PA9、PA10。
如果要使用PB6、PB7,那得重映射一下。
GPIO_PinRemapConfig(GPIO_Remap_USART1, ENABLE );

没看到你的重映射代码,你量一下PA9管脚是不是有波形,或者把外部串口接到PA9、PA10上去。

hujjj 发表于 2019-4-17 12:07:59

会不会是接线错误,试着将TX和RX交换一下.

thereborn000 发表于 2019-4-17 13:04:49

toofree 发表于 2019-4-17 12:26
USART1的管脚设置有问题,默认是PA9、PA10。
如果要使用PB6、PB7,那得重映射一下。
GPIO_PinRemapConfig(G ...

怎么重映射呀?就是说直接改不可以是吗?

thereborn000 发表于 2019-4-17 13:08:31

toofree 发表于 2019-4-17 12:26
USART1的管脚设置有问题,默认是PA9、PA10。
如果要使用PB6、PB7,那得重映射一下。
GPIO_PinRemapConfig(G ...

我看了貌似前面有

edmundlee 发表于 2019-4-17 14:15:21

USART 的 APB2Clock Enable 要放在初始化之前, 不先Clock Enable就设置不了的

thereborn000 发表于 2019-4-17 14:18:20

edmundlee 发表于 2019-4-17 14:15
USART 的 APB2Clock Enable 要放在初始化之前, 不先Clock Enable就设置不了的

那gpio的呢??

thereborn000 发表于 2019-4-17 14:21:02

thereborn000 发表于 2019-4-17 14:18
那gpio的呢??

这样吗??

s2333 发表于 2019-4-17 14:21:35

你用的是重映射引脚,需要重映射
GPIO_PinRemapConfig(GPIO_Remap_USART1,ENABLE);

edmundlee 发表于 2019-4-17 14:21:46

thereborn000 发表于 2019-4-17 14:18
那gpio的呢??

也一样, Clock Enable要放最前面
页: [1] 2 3
查看完整版本: 串口调试出不来