From: Daniel K. <dk...@ki...> - 2012-05-14 12:17:15
|
Uwe, My problem is solved - I accidentally mailed directly back to Tim rather than to the list. The problem was that although I had the correct VID and PID, the product descriptions in cablelist.txt didn't match the product description in my FT2232H module, so ftdi_usb_open_desc was rejecting the otherwise valid device. When I tried the ikda and bbv2 "cables" it worked, since in those cases the product description is ignored (in libftdi at least). So once the device was being correctly identified and opened, it detected my JTAG chain, and I successfully programmed my XC9572XL CPLD, so thanks very much for the code! To be helpful to others, you might want to put the following line into cablelist.txt: dlp2232h ftdi 1500000 0x0403:0x6010:DLP-2232H:1:0x00:0x10:0x00:0x0 which is an almost direct copy of the bbv2 entry. I chose to use the first channel on the ft2232h as part of my design. I'm not sure how to get at the second channel, perhaps that is buried in those extra parameters. Regards, Daniel -- On 14/05/2012, at 8:38 PM, Uwe Bonnes wrote: >>>>>> "Daniel" == Daniel Kirkham <dk...@ki...> writes: > > Daniel> Hello, I'm trying to get xc3sprog working to program an XC9572XL > Daniel> using an FT2232H-based module. I've managed to get it to > Daniel> compile, but it fails to open the device: > > Daniel> % ./xc3sprog -c ftdi XC3SPROG (c) 2004-2011 xc3sprog project > Daniel> $Rev: 655 $ OS: Linux Free software: If you contribute nothing, > Daniel> expect nothing! Feedback on success/failure/enhancement > Daniel> requests: > > Daniel> http://sourceforge.net/mail/?group_id=170565 Check Sourceforge > Daniel> for updates: > > Daniel> http://sourceforge.net/projects/xc3sprog/develop > > Daniel> Could not open FTDI device (using libftdi): device not found > Daniel> Unable to access FTDI device with either libftdi or FTD2XX > > Daniel> The FT2232 works ok in UART mode, and starts up ftdi_sio and > Daniel> usbserial automatically, and other programs are opening the > Daniel> device ok (eg. my eeprom reprogramming code). > > Daniel> I have been building a variety of libusb and libftdi libraries > Daniel> (to program the FT2232H's EEPROM) so my linux setup now has a > Daniel> mix of libusb0.1, libusb1.0, libftdi1 and libftdi2, which may be > Daniel> complicating matters. > > Daniel> % ldd ./xc3sprog linux-gate.so.1 => (0xb76ef000) libftdi.so.1 => > Daniel> /usr/lib/libftdi.so.1 (0xb76db000) libusb-0.1.so.4 => > Daniel> /lib/libusb-0.1.so.4 (0xb76d3000) libstdc++.so.6 => > Daniel> /usr/lib/libstdc++.so.6 (0xb75dd000) libm.so.6 => > Daniel> /lib/i686/cmov/libm.so.6 (0xb75b7000) libgcc_s.so.1 => > Daniel> /lib/libgcc_s.so.1 (0xb7599000) libc.so.6 => > Daniel> /lib/i686/cmov/libc.so.6 (0xb7453000) /lib/ld-linux.so.2 > Daniel> (0xb76f0000) > > Daniel> Here are some ltrace and strace outputs from near the end of the > Daniel> execution: > > Daniel> ltrace: ... ftdi_new(0xbf8e0786, 0x9d32c36, 47, 0xb7791a16, > Daniel> 0xb74fe866) = 0x9d348e8 ftdi_set_interface(0x9d348e8, 0, 47, > Daniel> 0xb7791a16, 0xb74fe866) = 0 ftdi_usb_open_desc(0x9d348e8, 1027, > Daniel> 24592, 0xbf8e0786, 0) = -3 ftdi_get_error_string(0x9d348e8, > Daniel> 1027, 24592, 0xbf8e0786, 0) = 0xb777925b fprintf(0xb762e560, > Daniel> "Could not open FTDI device (usin"...Could not open FTDI device > Daniel> (using libftdi): device not found ) = 61 ftdi_free(0x9d348e8, > Daniel> 0x807ee00, 0xb777925b, 0xbf8e0786, 0) = 4641 fwrite("Unable to > Daniel> access FTDI device wit"..., 1, 59, 0xb762e560Unable to access > Daniel> FTDI device with either libftdi or FTD2XX ) = 59 exit(1 > Daniel> <unfinished ...> +++ exited (status 1) +++ > > Daniel> The high level code seems to be looking for the correct device > Daniel> (0403:6010)... > > Daniel> strace: ... open("/dev/bus/usb/002/001", O_RDWR) = 3 ioctl(3, > Daniel> USBDEVFS_IOCTL, 0xbfdc79d4) = 3 close(3) = 0 > Daniel> open("/dev/bus/usb/001", > Daniel> O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 > Daniel> getdents(3, /* 3 entries */, 32768) = 48 > Daniel> open("/dev/bus/usb/001/001", O_RDWR) = 4 ioctl(4, > Daniel> USBDEVFS_CONNECTINFO, 0xbfdc79d8) = 0 read(4, > Daniel> "\22\1\20\1\t\0\0@k\35\1\0\6\2\3\2\1\1"..., 18) = 18 read(4, > Daniel> "\t\2\31\0\1\1\0\340"..., 8) = 8 read(4, > Daniel> "\0\t\4\0\0\1\t\0\0\0\7\5\201\3\2\0\377"..., 17) = 17 close(4) = > Daniel> 0 getdents(3, /* 0 entries */, 32768) = 0 close(3) = 0 > Daniel> open("/dev/bus/usb/001/001", O_RDWR) = 3 ioctl(3, > Daniel> USBDEVFS_IOCTL, 0xbfdc79d4) = 3 close(3) = 0 > Daniel> open("/dev/bus/usb/004/002", O_RDWR) = 3 ioctl(3, > Daniel> USBDEVFS_CONTROL, 0xbfdc78a0) = 4 ioctl(3, USBDEVFS_CONTROL, > Daniel> 0xbfdc78a0) = 20 close(3) = 0 write(2, "Could not open FTDI > Daniel> device (using"..., 61Could not open FTDI device (using libftdi): > Daniel> device not found ) = 61 write(2, "Unable to access FTDI device > Daniel> with"..., 59Unable to access FTDI device with either libftdi or > Daniel> FTD2XX ) = 59 exit_group(1) = ? > > Daniel> It appears to be identifying the correct low level device: > > Daniel> % lsusb Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 > Daniel> root hub Bus 004 Device 002: ID 0403:6010 Future Technology > Daniel> Devices International, Ltd FT2232C Dual USB-UART/FIFO IC Bus 004 > Daniel> Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 007 > Daniel> Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 > Daniel> Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 > Daniel> Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 > Daniel> Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 > Daniel> Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 > Daniel> Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > > Daniel> But presumably what is coming back from one or other of the > Daniel> ioctl(USBDEVFS_CONTROL) is not satisfying libftdi. > > Daniel> Before I dig any further, does anyone have any suggestions? > Daniel> What versions of the libraries are known to work with current > Daniel> xc3sprog code? Are there any debug switches I can turn on that > Daniel> might clarify what is going on? > > -v will make xc3sprog more verbose > But probably this will not give more clues for tat case. > > Do you have appropriate permissions on the device? Does VID:PID match. > The error > ftdi_usb_open_desc(0x9d348e8, 1027, 24592, 0xbf8e0786, 0) = -3 > ftdi_get_error_string(0x9d348e8, 1027, 24592, 0xbf8e0786, 0) = 0xb777925b > > The eoror is "usb device not found" as found in libftdi: > /** > Opens the index-th device with a given, vendor id, product id, > description and serial. > > \param ftdi pointer to ftdi_context > \param vendor Vendor ID > \param product Product ID > \param description Description to search for. Use NULL if not needed. > \param serial Serial to search for. Use NULL if not needed. > \param index Number of matching device to open if there are more than one, starts with 0. > > \retval 0: all fine > \retval -1: usb_find_busses() failed > \retval -2: usb_find_devices() failed > \retval -3: usb device not found > \retval -4: unable to open device > \retval -5: unable to claim device > \retval -6: reset failed > \retval -7: set baudrate failed > \retval -8: get product description failed > \retval -9: get serial number failed > \retval -10: unable to close device > \retval -11: ftdi context invalid > */ > int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, > > Hope this helps > > Bye > -- > Uwe Bonnes bo...@el... > > Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt > --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- |