From: Matt <li...@bu...> - 2012-05-14 12:20:05
|
On 05/12/12 15:35, Daniel Kirkham wrote: > Hello, > > I'm trying to get xc3sprog working to program an XC9572XL using an > FT2232H-based module. I've managed to get it to compile, but it fails to > open the device: > > % ./xc3sprog -c ftdi > XC3SPROG (c) 2004-2011 xc3sprog project $Rev: 655 $ OS: Linux > Free software: If you contribute nothing, expect nothing! > Feedback on success/failure/enhancement requests: > http://sourceforge.net/mail/?group_id=170565 > Check Sourceforge for updates: > http://sourceforge.net/projects/xc3sprog/develop > > Could not open FTDI device (using libftdi): device not found > Unable to access FTDI device with either libftdi or FTD2XX > > > The FT2232 works ok in UART mode, and starts up ftdi_sio and usbserial > automatically, and other programs are opening the device ok (eg. my > eeprom reprogramming code). > > I have been building a variety of libusb and libftdi libraries (to > program the FT2232H's EEPROM) so my linux setup now has a mix of > libusb0.1, libusb1.0, libftdi1 and libftdi2, which may be complicating > matters. > > % ldd ./xc3sprog > linux-gate.so.1 => (0xb76ef000) > libftdi.so.1 => /usr/lib/libftdi.so.1 (0xb76db000) > libusb-0.1.so.4 => /lib/libusb-0.1.so.4 (0xb76d3000) > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb75dd000) > libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb75b7000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7599000) > libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7453000) > /lib/ld-linux.so.2 (0xb76f0000) > > > Here are some ltrace and strace outputs from near the end of the execution: > > ltrace: > > ... > ftdi_new(0xbf8e0786, 0x9d32c36, 47, 0xb7791a16, 0xb74fe866) > = 0x9d348e8 > ftdi_set_interface(0x9d348e8, 0, 47, 0xb7791a16, 0xb74fe866) > = 0 > ftdi_usb_open_desc(0x9d348e8, 1027, 24592, 0xbf8e0786, 0) > = -3 > ftdi_get_error_string(0x9d348e8, 1027, 24592, 0xbf8e0786, 0) > = 0xb777925b > fprintf(0xb762e560, "Could not open FTDI device (usin"...Could not > open FTDI device (using libftdi): device not found > ) = 61 > ftdi_free(0x9d348e8, 0x807ee00, 0xb777925b, 0xbf8e0786, 0) > = 4641 > fwrite("Unable to access FTDI device wit"..., 1, 59, > 0xb762e560Unable to access FTDI device with either libftdi or FTD2XX > ) = 59 > exit(1 <unfinished ...> > +++ exited (status 1) +++ > > > The high level code seems to be looking for the correct device > (0403:6010)... > > strace: > > ... > open("/dev/bus/usb/002/001", O_RDWR) = 3 > ioctl(3, USBDEVFS_IOCTL, 0xbfdc79d4) = 3 > close(3) = 0 > open("/dev/bus/usb/001", > O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 > getdents(3, /* 3 entries */, 32768) = 48 > open("/dev/bus/usb/001/001", O_RDWR) = 4 > ioctl(4, USBDEVFS_CONNECTINFO, 0xbfdc79d8) = 0 > read(4, "\22\1\20\1\t\0\0@k\35\1\0\6\2\3\2\1\1"..., 18) = 18 > read(4, "\t\2\31\0\1\1\0\340"..., 8) = 8 > read(4, "\0\t\4\0\0\1\t\0\0\0\7\5\201\3\2\0\377"..., 17) = 17 > close(4) = 0 > getdents(3, /* 0 entries */, 32768) = 0 > close(3) = 0 > open("/dev/bus/usb/001/001", O_RDWR) = 3 > ioctl(3, USBDEVFS_IOCTL, 0xbfdc79d4) = 3 > close(3) = 0 > open("/dev/bus/usb/004/002", O_RDWR) = 3 > ioctl(3, USBDEVFS_CONTROL, 0xbfdc78a0) = 4 > ioctl(3, USBDEVFS_CONTROL, 0xbfdc78a0) = 20 > close(3) = 0 > write(2, "Could not open FTDI device (using"..., 61Could not open > FTDI device (using libftdi): device not found > ) = 61 > write(2, "Unable to access FTDI device with"..., 59Unable to access > FTDI device with either libftdi or FTD2XX > ) = 59 > exit_group(1) = ? > > > It appears to be identifying the correct low level device: > > % lsusb > Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub > Bus 004 Device 002: ID 0403:6010 Future Technology Devices > International, Ltd FT2232C Dual USB-UART/FIFO IC > Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub > Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > > > But presumably what is coming back from one or other of the > ioctl(USBDEVFS_CONTROL) is not satisfying libftdi. > > Before I dig any further, does anyone have any suggestions? > What versions of the libraries are known to work with current xc3sprog code? > Are there any debug switches I can turn on that might clarify what is > going on? > > Many thanks, > > Daniel Kirkham Connect your FTDI device while monitoring syslog (or check dmesg after connecting your FTDI device device) and verify that the USB device IDs reported by the kernel match the vid & pid IDs that xc3sprog is using to open the device (defined in cablelist.txt). Cheers, -- Matt |