openFPGALoader: unable to open ftdi device: -4 (usb_open() failed)

Problem:

$ openFPGALoader -b arty_a7_35t /home/foo/git/external/f4pga-examples/xc7/counter_test/build/arty_35/top.bit
unable to open ftdi device: -4 (usb_open() failed)
JTAG init failed with: unable to open ftdi device

More info:

$ uname -a
Linux baz 5.10.0-16-amd64 #1 SMP Debian 5.10.127-2 (2022-07-23) x86_64 GNU/Linux

$ openFPGALoader -V
openFPGALoader v0.8.0

$ lsusb
Bus 004 Device 007: ID 0403:6010 Future Technology Devices International, Ltd FT2232C/D/H Dual UART/FIFO IC
...

$ sudo dmesg |grep -i usb
...
usb 4-6: Detected FT2232H
usb 4-6: FTDI USB Serial Device converter now attached to ttyUSB1

$ ls -l /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 1 Aug 12 13:38 /dev/ttyUSB1

$ getent group dialout
dialout:x:20:foo

$ picocom -b 115200 --imap lfcrlf /dev/ttyUSB1
...
**        Avnet/Digilent Arty Evaluation Board        **
**        LEDs and switches GPIO Demonstration        **
********************************************************
********************************************************
**
Choose Task:
BTN0: Print PWM value.
BTN1: 'Cylon' LED display.
...

$ openFPGALoader -b arty_a7_35t --detect
unable to open ftdi device: -4 (usb_open() failed)
JTAG init failed with: unable to open ftdi device


About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@infinitesteps - slight modification (does not grant access to ‘others’). Oddly, the apparent permissions were exactly the same for me before and after adding this udev rule but it does indeed work 😃

# add user to dialout group
sudo usermod -a -G $USER dialout
# gain new group access without logging out/in
exec su -l $USER
# add udev rules
sudo cat <<< EOF > /etc/udev/rules.d/99-ftdi.rules
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0660", GROUP="dialout"
EOF
sudo udevadm control --reload-rules && sudo udevadm trigger

I fixed it. I had to add the following udev rule:

File: /etc/udev/rules.d/99-ftdi.rules

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666"

For others who arrive here with different boards, change the vendor and product to match the hex values produced by lsusb. For example here is mine:

Bus 002 Device 004: ID 0403:6010 Future Technology Devices International, Ltd FT2232C/D/H Dual UART/FIFO IC

Couple of notes…

  1. I came to openFPGALoader indirectly through F4PGA. I was following their documentation and so it might not be a fault of the this projects documentation.
  2. Thanks for the tip on the 0660 @cfriedt - I thought it was odd that it needed world permission. I don’t know how udev works but the filesystem permissions were 0660 without the udev rule and it was not working for me (even after logout). I even changed the filesystem perms to 0666 without luck. It wasn’t until the udev rule that things started working.
  3. @trabucayre I got a clue about the problem when I built and ran simple.c from the libftdi project (that corresponded to my systems version of libftdi). The error message was more informative. I can’t remember exactly how the ftdi_usb_open() is called but I don’t think it uses the error message provided by libftdi - that might be helpful.

Thanks! A udev rule is provided with openFPGALoader (https://trabucayre.github.io/openFPGALoader/guide/install.html#udev-rules) but maybe this note is not correctly highlity and maybe with the binary version this file is not available.