2

After connecting an FTDI device to the USB port, FT_OpenEx() returns an error code 2 which is FT_DEVICE_NOT_FOUND. However on running "lsusb" in the terminal, the FTDI device does show up. What is causing FT_Open_Ex() to return FT_DEVICE_NOT_FOUND if the device is listed by lsusb? What are the possible issues and solutions?

Output of lsusb:

Bus 001 Device 003: ID 0bda:5776 Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Output of dmesg | grep FTDI :

[28153.244220] usbserial: USB Serial support registered for FTDI USB Serial Device
[28153.244260] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
[28153.244509] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0

Output of dmesg | grep -i FTDI:

[28153.244206] usbcore: registered new interface driver ftdi_sio
[28153.244220] usbserial: USB Serial support registered for FTDI USB Serial Device
[28153.244260] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
[28153.244509] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
humblewolf
  • 21
  • 1
  • 6

2 Answers2

3

The dmesg output shows that ftdi_sio (a kernel module) has claimed the USB port to simulate a serial port. This is the default behaviour for a typical Ubuntu installation.

FT_OpenEx is part of the FTDI D2XX API, which cannot access a device already claimed by ftdi_sio.

The FTDI Linux D2XX notes suggest:

sudo lsmod 

If "ftdi_sio" is listed: Unload it (and its helper module, usbserial), as follows.

sudo rmmod ftdi_sio
sudo rmmod usbserial

This will allow a D2XX program to access the device until the next reboot when the kernel will again load ftdi_sio. This answer gives one way to avoid having to manually unload it after every reboot.

0

Do you have read/write permissions on the device? can you try sudo chmod 666 /dev/ttyUSB0

to make this permanent make a udev rule

create this file /etc/udev/rules.d/99-ftdi.rules

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS={idProduct}=="6001"

richmb
  • 1,495
  • 2
  • 15
  • 20