libftdi Archives

Subject: Re: FT2232H asynchronous maximum data rates?

From: Caleb Kemere <ckemere@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 20 Jun 2011 11:42:58 -0700
On Mon, Jun 20, 2011 at 3:26 AM, Uwe Bonnes
<bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>>>>> "Caleb" == Caleb Kemere <ckemere@xxxxxxxxx> writes:
>    Uwe> Otherwise, how do you read on the PC side? Do yo do asynchronous
>    Uwe> reads like in libftdi-1.0/src/ftdi_stream.c?
>
>    Caleb> I did test the asynchronous mode, but now I think I've distilled
>    Caleb> the essence of the test down to the following really simple
>    Caleb> (blocking) code:
>
>    Caleb> int transferred = 0; int bytes = 0; while (bytes <
>    Caleb> MAXIMUM_TRANSFER) { last_result =
>    Caleb> libusb_bulk_transfer(ftdi.usb_dev, ftdi.out_ep, buffer,
>    Caleb> bufferSize, &transferred, 1000); if ((last_result > 0) |
>    Caleb> (transferred == 2)) break; else bytes+= transferred; }
>
>    Caleb> I've been messing around with different values for the
>    Caleb> read-chunksize of the FT2232H and the bufferSize of the bulk
>    Caleb> transfer. As a reminder, my data streams from the FPGA to the
>    Caleb> FT2232H at 6.5 MB/s. With that, I can consistently read for about
>    Caleb> a 30 s or so before I get a buffer overflow (at half speed, I can
>    Caleb> go for about 3 times that long). It seems like the USB subsystem
>    Caleb> should be able to handle that data rate for an arbitrary length
>    Caleb> of time, so I'm wondering what I could be doing wrong...
>
Uwe> Otherwise, why do you stop when you read 2 bytes? The FTDI will
alway return
Uwe> 2 status bytes, so this is a legal value which might happen sometimes.

I my case, a two byte message indicates that the transfer buffer on
the FT2232H is empty, which happens when the FPGA stops transmitting
because it has detected a buffer overflow previously. Unfortunately,
for our application, we can't tolerate lost data (or rather, we need
something like 99.9%), hence trying to debug.

I have noticed something which I don't understand - on my laptop (Core
2 Duo, about 3 years old), I get the performance described above. On
my desktop (Core i5, about 2 years old), I can run for many minutes
without ever running into trouble. Is there some way of understanding
what the USB on the laptop is doing differently?

thanks!
– caleb

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

Current Thread