Raspberry Pi UART系列无法正常工作

Mar*_*Law 8 serial-port uart raspberry-pi

我试图通过串行连接(GPIO UART引脚)在Raspberry Pi(B型号,raspian wheezy)和STM32F4板之间发送/接收数据.

要设置串口,我按照以下几个教程中的所有步骤进行操作:http://elinux.org/RPi_Serial_Connection#Preventing_Linux_using_the_serial_port

当无法获取到STM32F4板的连接,我读了你可以在本地测试的PI串口,如果你只需连接TX,RX引脚关PI海誓山盟,它应该只是重复Minicom中输入的数据.

遗憾的是,这也不起作用.

文件'cmdline'和'inittab'中ttyAMA0的设置正常.(如许多教程中所述)

并且还尝试了https://github.com/lurch/rpi-serial-console的自动配置程序

直接将RX连接到rpi上的TX引脚不会在minicom中提供任何输出.我还尝试了一个重复给定输入的python脚本.似乎什么都没有用,我有点迷失在这里.

Minicom启动命令应该是正确的(尝试使用不同的波特率):

root@raspberrypi:/home/jef# minicom -b 9600 -o -D /dev/ttyAMA0

OPTIONS: I18n
Compiled on Apr 28 2012, 19:24:31.
Port /dev/ttyAMA0
Run Code Online (Sandbox Code Playgroud)

在minicom的底部,它总是显示离线状态:

CTRL-A Z for help |  9600 8N1 | NOR | Minicom 2.6.1  | VT102 |      Offline
Run Code Online (Sandbox Code Playgroud)

当使用python nothinig检查可用的串口时,会抛出:

python -m serial.tools.list_ports
no ports found
Run Code Online (Sandbox Code Playgroud)

用户在dailout组中,因此不应该是问题(以root和non root身份尝试):

root@raspberrypi:/home/jef# id
uid=0(root) gid=0(root) groups=0(root),20(dialout),1001(indiecity)
Run Code Online (Sandbox Code Playgroud)

验证getty不再使用串口:

root@raspberrypi:/home/jef# ps aux | grep getty
root      2809  0.0  0.1   3740   804 tty1     Ss+  10:36   0:00 /sbin/getty --noclear 38400 tty1
root      2810  0.0  0.1   3740   804 tty2     Ss+  10:36   0:00 /sbin/getty 38400 tty2
root      2811  0.0  0.1   3740   804 tty3     Ss+  10:36   0:00 /sbin/getty 38400 tty3
root      2812  0.0  0.1   3740   804 tty4     Ss+  10:36   0:00 /sbin/getty 38400 tty4
root      2813  0.0  0.1   3740   804 tty5     Ss+  10:36   0:00 /sbin/getty 38400 tty5
root      2814  0.0  0.1   3740   804 tty6     Ss+  10:36   0:00 /sbin/getty 38400 tty6
root      3129  0.0  0.1   2012   624 pts/0    S+   11:57   0:00 grep getty
Run Code Online (Sandbox Code Playgroud)

我使用ttyAMA0检查了其他应用程序,也没有:

root@raspberrypi:/home/jef# ps aux | grep ttyAMA0
root      3125  0.0  0.1   2012   628 pts/0    S+   11:56   0:00 grep ttyAMA0
Run Code Online (Sandbox Code Playgroud)

用户具有访问串口的正确权限:

root@raspberrypi:/home/jef# ls -l /dev/ttyAMA0
crw-rw---T 1 root dialout 204, 64 Dec 25 11:53 /dev/ttyAMA0
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?我阅读了大约20个关于如何设置串口的不同教程和博客,我不喜欢导致这种情况的原因.你能给我一些我可以寻找的建议吗?

小智 5

我今天刚刚经历过类似的事情。我必须设置 minicom 来禁用硬件控制,循环对我有用,并且通过 UART 将 2 个 Raspi 交叉连接在一起。

另外,我在 TTYAMA0 连接字符串上使用 115200 buad 速率 minicom -b 115200 -o -D /dev/ttyAMA0

替代A

Z

串行端口设置 [输入]

F 关闭硬件流控制

*保存这些设置,您输入的任何内容都应该显示在屏幕上,但实际上是通过 uart 传输的。

我的 minicom 页脚看起来也像这样(只是不同的波特率,但也显示离线但有效)

CTRL-A Z 寻求帮助 |115200 8N1 | 也不| 迷你电脑2.5 | VT102 | 离线

祝你好运!


Rob*_*unt 3

我有一个 Arduino 通过电平转换器(3.3v 到 5v)连接到我的 Raspberry Pi 串行端口,并且 minicom 也有问题。我可以接收 minicom 中 Arduino 的输出,但无论我尝试什么设置,都无法发送任何内容。我在使用插入 USB (/dev/ttyUSB0) 的 Arduino 的 minicom 上也遇到了完全相同的问题。

最后我求助于使用基本的 python 串行控制台,使用 pip 安装 pyserial (pip install pyserial) 并执行以下命令:

python -m serial.tools.miniterm -p /dev/ttyAMA0 -e
Run Code Online (Sandbox Code Playgroud)