【问题标题】:I can't open serial port to FTDI FT2232HQ chip我无法打开 FTDI FT2232HQ 芯片的串口
【发布时间】:2020-10-27 09:06:05
【问题描述】:

我有一块 PYNQ-Z2 板,它包含 FT2232HQ 芯片,将数据从 USB 转换为 JTAG 和 UART

问题是开发板正在工作并且被 Vivado 检测到(我可以对其进行编程),但设备没有显示为/dev/ttyUSB* 设备,而是显示为/dev/ftdi-x(其中 x 是随机数) 并且我无法使用此设备文件打开串行端口。

我使用lsusb命令,发现芯片检测正确:

Bus 003 Device 017: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC

之后,我尝试检查 syslog 文件,发现两个奇怪的行为,第一个是当我连接板时,两个 ttyUSB 设备被识别,而不是一个! /dev/ttyUSB0 & /dev/ttyUSB1.

第二种行为是这两个设备在连接后立即断开连接。

这是完整的系统日志

Oct 27 11:45:20 ao20xa kernel: [73109.798748] usb 3-4: new high-speed USB device number 17 using xhci_hcd
Oct 27 11:45:21 ao20xa kernel: [73109.949757] usb 3-4: New USB device found, idVendor=0403, idProduct=6010
Oct 27 11:45:21 ao20xa kernel: [73109.949761] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 27 11:45:21 ao20xa kernel: [73109.949763] usb 3-4: Product: TUL
Oct 27 11:45:21 ao20xa kernel: [73109.949765] usb 3-4: Manufacturer: Xilinx
Oct 27 11:45:21 ao20xa kernel: [73109.949767] usb 3-4: SerialNumber: 1234-tul
Oct 27 11:45:21 ao20xa kernel: [73109.950844] ftdi_sio 3-4:1.0: FTDI USB Serial Device converter detected
Oct 27 11:45:21 ao20xa kernel: [73109.950899] usb 3-4: Detected FT2232H
Oct 27 11:45:21 ao20xa kernel: [73109.951100] usb 3-4: FTDI USB Serial Device converter now attached to ttyUSB0
Oct 27 11:45:21 ao20xa kernel: [73109.951815] ftdi_sio 3-4:1.1: FTDI USB Serial Device converter detected
Oct 27 11:45:21 ao20xa kernel: [73109.951861] usb 3-4: Detected FT2232H
Oct 27 11:45:21 ao20xa kernel: [73109.952058] usb 3-4: FTDI USB Serial Device converter now attached to ttyUSB1
Oct 27 11:45:21 ao20xa mtp-probe: checking bus 3, device 17: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-4"
Oct 27 11:45:21 ao20xa mtp-probe: bus: 3, device: 17 was not an MTP device
Oct 27 11:45:21 ao20xa systemd-udevd[18701]: Process '/bin/sh -c 'basename $(dirname $(realpath /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/device)) > /sys/bus/usb/drivers/ftdi_sio/unbind'' failed with exit code 1.
Oct 27 11:45:21 ao20xa kernel: [73110.089464] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
Oct 27 11:45:21 ao20xa kernel: [73110.089536] ftdi_sio 3-4:1.1: device disconnected
Oct 27 11:45:21 ao20xa kernel: [73110.089818] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
Oct 27 11:45:21 ao20xa kernel: [73110.089865] ftdi_sio 3-4:1.0: device disconnected
Oct 27 11:45:21 ao20xa snapd[16139]: hotplug.go:199: hotplug device add event ignored, enable experimental.hotplug
Oct 27 11:45:21 ao20xa upowerd[1835]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.0
Oct 27 11:45:21 ao20xa snapd[16139]: hotplug.go:199: hotplug device add event ignored, enable experimental.hotplug
Oct 27 11:45:21 ao20xa upowerd[1835]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.1
Oct 27 11:45:21 ao20xa systemd-udevd[18701]: Process '/bin/sh -c 'basename $(dirname $(realpath /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/device)) > /sys/bus/usb/drivers/ftdi_sio/unbind'' failed with exit code 1.
Oct 27 11:45:21 ao20xa upowerd[1835]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4
Oct 27 11:45:21 ao20xa ModemManager[1044]: <info>  (tty/ttyUSB0): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-4'
Oct 27 11:45:21 ao20xa ModemManager[1044]: <info>  (tty/ttyUSB1): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-4'
Oct 27 11:45:21 ao20xa ModemManager[1044]: <info>  Couldn't check support for device '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-4': Operation was cancelled
Oct 27 11:45:21 ao20xa upowerd[1835]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.0
Oct 27 11:45:21 ao20xa upowerd[1835]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.1

所以,我想知道是否有人可以帮助解决这个问题。

【问题讨论】:

  • 这两个 ttyUSB 设备将是因为 FT2232HQ 有两个 USB 接口描述符(检查lsusb -v 输出中的bNumInterfaces 值),每个都实现一个串行端口。 ttyUSB 设备消失的其余奇怪行为似乎是由于某些自定义 UDEV 规则在您的系统上运行某种自定义脚本造成的。
  • 所以对于初学者来说,尝试grep -l ftdi_sio /etc/udev/rules.d/*.rules 然后列出匹配的 *.rules 文件的内容。如果没有列出,请尝试使用 /lib/udev/rules.d/*.rules 代替。
  • 我在第一个目录找到了一个文件,第二个是空的,第一个文件是:/etc/udev/rules.d/10-lattice.rules,下面是它的内容:ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", SYMLINK+="ftdi-%n", RUN+="/bin/sh -c 'basename $(dirname $(realpath /sys%p/device)) &gt; /sys/bus/usb/drivers/ftdi_sio/unbind'",RUN+="/root/ftdi_fixer.py"
  • 非常感谢lan Abbott,我在文件中注释了这一行,现在一切正常,我尝试了UART,它工作正常。似乎此行运行脚本以在连接设备后解除绑定。
  • 但我想知道,这个脚本不应该停止 UART 和 JTAG,为什么 JTAG 工作?

标签: linux-kernel embedded embedded-linux ftdi zynq


【解决方案1】:

就我而言,我的用户不在dialout 组中。当我添加时:

sudo adduser <my_user> dialout

然后注销再登录,在寻找答案数小时后,我终于成功连接到串行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多