libftdi Archives

Subject: FT2232H bug: wrong maxpacket at full speed

From: David Brownell <david-b@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 1 Nov 2009 21:29:56 -0700
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.

- Dave

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

Current Thread