libftdi Archives

Subject: Re: FT2232H asynchronous maximum data rates?

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 20 Jun 2011 12:26:49 +0200
>>>>> "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...

    Caleb> thanks! 

Two more things to consider.

- Run your program with valgrind to see if we have a memory leak.

- Try to read from the plain device /dev/ttyUSBx with ftdi_sio loaded


Otherwise, why do you stop when you read 2 bytes? The FTDI will alway return
2 status bytes, so this is a legal value which might happen sometimes. 

Your program must also strip these two databyte from each transfer. Reading
from /dev/ttyUSBx strips these bytes automatic

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

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

Current Thread