libftdi Archives

Subject: Re: FT2232H bug: wrong maxpacket at full speed

From: "Thimo E." <abc@xxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 02 Nov 2009 10:14:28 +0100
Dear all,

please refer to my post some months ago:

http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00178.html

There are some other bugs with FT2232H which are still not fixed upstream.

Comments are highly appreciated.

Best regards
 Thimo

Thomas Jarosch schrieb:
Hello Dave,

On Monday, 2. November 2009 05:29:56 David Brownell wrote:
When running an FT2232H at full speed, we saw a new failure mode that
turned out to be a bug in libftdi.  Current git:

int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int
 size) {
    int offset = 0, ret = 1, i, num_of_chunks, chunk_remains;
    int packet_size;

    // New hi-speed devices from FTDI use a packet size of 512 bytes
    if (ftdi->type == TYPE_2232H || ftdi->type == TYPE_4232H)
        packet_size = 512;
    else
        packet_size = 64;

    ....

So there's a clear and *INCORRECT* assumption that highspeed-capable
devices are never going to run at full speed, where packet_size != 512
but instead is the traditional 64 bytes (on these chips).

Failure mode:  two-byte "modem" status codes bubbling up in the middle
of JTAG transactions.  Rude...

I have no patch for this; just reporting the bug.  It's clearly fixable
on Linux, which is our priority (OpenOCD, for JTAG) by asking sysfs for
the device's "speed" attribute (12 or 480 MHz), or (more awkwardly) the
endpoint's wMaxPacketSize.  Other operating systems -- no comments.

Thanks for reporting this issue. Maybe there's a way to ask libusb
about the maximum packet size, I'll have to check that. Otherwise
we would need to go the sysfs route.

Does anyone know if it's a valid thing to do for a USB device
to switch to a lower speed during one "session"?

Cheers,
Thomas

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
Current Thread