libftdi Archives

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

From: David Brownell <david-b@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: "Thimo E." <abc@xxxxxxxxxx>
Date: Mon, 2 Nov 2009 02:54:33 -0700
On Monday 02 November 2009, Thimo E. wrote:
> 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.

I thought I remembered seeing an email in the list
archives that had some not-yet-fixed bugs.  I think
that was likely the one.

I don't yet have an FT2232H device, but after seeing
this issue crop up ... I'm quite certain we'll be
seeing OpenOCD v0.3.x users tripping over that bug.


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

looked interesting too (very recent post).


> Comments are highly appreciated.

No comments for now on your patch, beyond "looks plausiable".

But I see your issue #3 is the same one I noted.  This is part
of why it's a good idea to avoid complex emails ... if you'd
posted your open issue separately, I suspect the more obvious
stuff would have gotten responses!  ;)

- Dave



> 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   

Current Thread