如何在RPi Zero W中正确配置串行端口? 我有一顶SIM7000帽子,需要通过UART通讯。
因此,我转到RPI官方页面并...阅读文档... 我做了什么:
raspi-config->禁用串行控制台,启用串行硬件
编辑cmdline.txt->删除“ console = serial0,115200” (sudo nano /boot/cmdline.txt)
编辑config.txt->检查是否为enable-uart = 1 (sudo nano /boot/config.txt)
我不需要蓝牙,因此我想禁用它。然后,添加到config.txt "dtoverlay=pi3-disable-bt"
禁用系统服务:sudo systemctl disable hciuart
重新启动
根据文档,一切正常
什么都没有。我正在尝试通过minicom或picocom连接,无法发送或接收任何东西...
sudo minicom -D /dev/serial0
或minicom -D /dev/ttyAMA0
并冻结终端
picocom --baud 9600 /dev/ttyAMA0
或serial0并冻结
尝试使用python代码,打开串口,尝试发送和接收某物,什么都没有...
ls -l /dev
告诉我
serial0-> ttyAMA0,serial1-> ttyS0
dmesg | grep tty
告诉我
[0.001271]控制台[tty1]已启用 [1.051160] 20201000.serial:MMIO 0x20201000(irq = 81,base_baud = 0)上的ttyAMA0是PL011 rev2
我访问了Google上的所有页面。
我尝试使用pi3-miniuart-bt
和sudo systemctl stop serial-getty@ttyS0.service
和disable serial-getty...
有人知道如何进行串行工作吗?
这是完整的/boot/config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=off
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
enable_uart=1
dtoverlay=pi3-disable-bt
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
尝试picocom:
pi@raspberrypi:~ $ picocom /dev/ttyAMA0
picocom v3.1
port is : /dev/ttyAMA0
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
Type [C-a] [C-h] to see available commands
Terminal ready
我不会写
尝试Minicom:
Welcome to minicom 2.7.1
OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/serial0, 20:12:31
Press CTRL-A Z for help on special keys
我不能写...。
我确实从该页面想到过: CONFIGURING GPIO SERIAL RPI