Hello,

i can't reproduce your errors. The libftdi and d2xx works like a charm here 
(linux/windows). Error 4
means IO Error. I think you have carefully check your USB cables and your 
hardware. If you work with
linux you can try "dmesg" to get some reports about hardware problems, 
specially usb.


Regards,

Mathias

Am 29.03.2011 12:37, schrieb Drasko DRASKOVIC:
> Hi all,
> commenting out FT_GetLatencyTimer() call seems to be a workaround :
> 
> 
> #if 0
>       if ((status = FT_GetLatencyTimer(ftdih, &latency_timer)) != FT_OK)
>       {
>               LOG_ERROR("unable to get latency timer: %lu", status);
>               return ERROR_JTAG_INIT_FAILED;
>       }
>       else
> #endif
>       {
>               latency_timer = 2;
>               LOG_DEBUG("current latency timer: %i", latency_timer);
>       }
> 
> I have no idea why this function is not working.
> 
> This workaround seems to be fixing
> Error: couldn't read enough bytes from FT2232 device (0 < 5)
> problem that I saw before with libftdi.
> 
> However, more surprising are build problems with OpenOCD and D2XX
> 1.0.4 that I described below.
> 
> BR,
> Drasko
> 
> On Mon, Mar 28, 2011 at 4:07 PM, Drasko DRASKOVIC
> <[email protected]> wrote:
>> Hi all,
>> I downloaded D2XX driver from here :
>> http://www.ftdichip.com/Drivers/D2XX.htm. It is version 1.0.4 for
>> Linux x86 (32-bit).
>>
>> I tried compiling OpenOCD with libftd2xx statically (which is by
>> default). Configuration is failing with :
>>
>> checking uninstalled ftd2xx distribution...
>> -L/home/ddraskovic/sandbox/libftd2xx1.0.4/libftd2xx1.0.4/static_lib
>> /home/ddraskovic/sandbox/libftd2xx1.0.4/libftd2xx1.0.4/static_lib/libftd2xx.a
>> checking whether ftd2xx library works... configure: error: Cannot
>> build & run test program using ftd2xx.lib
>>
>> In config.log I saw :
>>
>> /home/ddraskovic/sandbox/libftd2xx1.0.4/libftd2xx1.0.4/static_lib/libftd2xx.a(ftd2xx.o):
>> In function `FTCommonOpen':
>> /home/madamson/Desktop/Mac-Linux sources/libftd2xx/ftd2xx.c:1654:
>> undefined reference to `pthread_create'
>> /home/madamson/Desktop/Mac-Linux sources/libftd2xx/ftd2xx.c:1656:
>> undefined reference to `pthread_create'
>> /home/ddraskovic/sandbox/libftd2xx1.0.4/libftd2xx1.0.4/static_lib/libftd2xx.a(ftd2xx.o):
>> In function `FT_Close':
>> /home/madamson/Desktop/Mac-Linux sources/libftd2xx/ftd2xx.c:1812:
>> undefined reference to `pthread_join'
>> /home/madamson/Desktop/Mac-Linux sources/libftd2xx/ftd2xx.c:1821:
>> undefined reference to `pthread_join'
>>
>> So obviously it was missing libpthrads.
>>
>> After adding -lpthread to CFLAGS, there is another problem :
>>
>> /home/ddraskovic/sandbox/libftd2xx1.0.4/libftd2xx1.0.4/static_lib/libftd2xx.a(linux_usbfs.o):
>> In function `find_monotonic_clock':
>> /home/madamson/Desktop/Mac-Linux
>> sources/libftd2xx/libusb/libusb/os/linux_usbfs.c:206: undefined
>> reference to `clock_gettime'
>> /home/ddraskovic/sandbox/libftd2xx1.0.4/libftd2xx1.0.4/static_lib/libftd2xx.a(linux_usbfs.o):
>> In function `op_clock_gettime':
>> /home/madamson/Desktop/Mac-Linux
>> sources/libftd2xx/libusb/libusb/os/linux_usbfs.c:2146: undefined
>> reference to `clock_gettime'
>> /home/madamson/Desktop/Mac-Linux
>> sources/libftd2xx/libusb/libusb/os/linux_usbfs.c:2148: undefined
>> reference to `clock_gettime'
>>
>> So librt is already missing, and I had to add -lrt also to CFLAGS.
>>
>> After this I was able to sucessfully compile OpenOCD with libftd2xx,
>> with observation of warnings like this during compile :
>>
>>
>> ft2232.c: In function ‘ft2232_write’:
>> ft2232.c:512: warning: format ‘%lu’ expects type ‘long unsigned int’,
>> but argument 6 has type ‘FT_STATUS’
>> ft2232.c: In function ‘ft2232_read’:
>> ft2232.c:555: warning: format ‘%lu’ expects type ‘long unsigned int’,
>> but argument 6 has type ‘FT_STATUS’
>> ft2232.c: In function ‘ft2232_init_ftd2xx’:
>> ft2232.c:2194: warning: format ‘%lu’ expects type ‘long unsigned int’,
>> but argument 6 has type ‘FT_STATUS’
>> ft2232.c:2198: warning: format ‘%lu’ expects type ‘long unsigned int’,
>> but argument 6 has type ‘FT_STATUS’
>> ft2232.c:2214: warning: format ‘%lu’ expects type ‘long unsigned int’,
>> but argument 6 has type ‘DWORD’
>>
>> Same kind of wornings are present when we compile libftd2xx as a shared 
>> library.
>>
>> When I try to start newly compiled OpenOCD binary I am getting :
>>
>>
>> Debug: 169 18 ft2232.c:2433 ft2232_init() 104248: ft2232 interface
>> using shortest path jtag state transitions
>> Debug: 170 18 ft2232.c:2133 ft2232_init_ftd2xx() 104248: 'ft2232'
>> interface using FTD2XX with 'jtagkey' layout (0403:cff8)
>> Error: 171 56 ft2232.c:2239 ft2232_init_ftd2xx() 137560: unable to get
>> latency timer: 4
>> Debug: 172 56 command.c:638 run_command() 137448: Command failed with
>> error code -100
>>
>> Came behavior with libftd2xx as a shared lib.
>>
>> libftd2xx0.4.16 which I used before does not show this error (but has
>> some other problems and that's why I want to replace it with new
>> version or ideally Amontec officiel drivers).
>>
>> I am using Amontec JTAGKey2 probe. Since Officiel Amontec drivers are
>> based on version 1.0.4 of D2XX I am getting exactly same error.
>>
>> What can be wrong here ?
>>
>> Best regards,
>> Drasko
>>
> _______________________________________________
> Openocd-development mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/openocd-development
> 

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to