正确连接串口线
确保串口线可用,即在其他机器上面正常使用
确保正确连接串口线,RX,TX,GND3条线准确连接,不确定线序,可以拆开串口线的主板外壳,查看焊点位置的标识
确保设备上电并能正常工作
确保设备内部或者烧录的固件为uart固件
安装minicom
sudo apt-get install -y minicom
确认串口连接
确认usb设备是否存在
fuqiang@fuqiang-VivoBook:~$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 009: ID 413c:2113 Dell Computer Corp. KB216 Wired Keyboard
Bus 003 Device 003: ID 13d3:5463 IMC Networks USB2.0 HD UVC WebCam
Bus 003 Device 005: ID 8087:0033 Intel Corp.
Bus 003 Device 015: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
确认串口节点是否存在
fuqiang@fuqiang-VivoBook:~$ ls -al /dev/ttyU*
crw-rw---- 1 root dialout 188, 0 7月 22 09:45 /dev/ttyUSB0
fuqiang@fuqiang-VivoBook:~$
配置minicom
进入配置界面
sudo minicom -s
上下键移动,选择“串口设置”,ENTER键进入
按a设置串口的节点,其他设置也按照上图设置完成,退到上一界面,选择“保存设置为dfl”,退出即可
进入串口
minicom
异常排查
无/dev/ttyUSB*节点
fuqiang@fuqiang-VivoBook:~$ ls -al /dev/ttyU*
ls: 无法访问 '/dev/ttyU*': 没有那个文件或目录
dmesg查看内核打印,如下,发现其连接上后又卸载了
[ 3046.257082] usb 3-1: new full-speed USB device number 16 using xhci_hcd
[ 3046.413789] usb 3-1: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[ 3046.413800] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3046.413804] usb 3-1: Product: FT232R USB UART
[ 3046.413808] usb 3-1: Manufacturer: FTDI
[ 3046.413810] usb 3-1: SerialNumber: A50285BI
[ 3046.418181] ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected
[ 3046.418224] usb 3-1: Detected FT232RL
[ 3046.419242] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0
[ 3046.952074] input: BRLTTY 6.4 Linux Screen Driver Keyboard as /devices/virtual/input/input22
[ 3047.081112] usb 3-1: usbfs: interface 0 claimed by ftdi_sio while 'brltty' sets config #1
[ 3047.082024] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 3047.082053] ftdi_sio 3-1:1.0: device disconnected
怀疑和brltty有关,拆卸brltty
sudo apt-get remove brltty
再次拔插USB,发现可以识别到串口节点
fuqiang@fuqiang-VivoBook:~$ ls -al /dev/ttyU*
crw-rw---- 1 root dialout 188, 0 7月 22 09:59 /dev/ttyUSB0