From: Tim R. <ti...@pr...> - 2006-08-10 16:00:17
|
Guenther Sohler wrote: >I have now done standalone testcase program(without GTK) >and the measured datarate is definiely higher :) > >Its about 2-3 Myte/S, which is correct! this is the currently expected data rate! >However. There still seems some data missed(i send patterns like 0,1,2,3,4 ..15,0,2,3, ..) >and checking the order in my pc comes out that its not consistant) >Probably there is a buffer overrun on my fx2 device which has just 1 512 Bytes buffer and i transfer 256 Bytes each transfer. > > As I replied on the Linux newsgroups last night, you need to use larger buffers. We are able to get 22 MB/s on a bulk pipe from an FX2 device using the usbfs machinery (which is what libusb uses), using normal synchronous requests, just by doing 32k bytes per transfer. We are able to get 30 MB/s on the same device using asynchronous requests, by submitting several at a time. >256 Bytes Each. I can't do more as the buffer on the FX2 is just 512 Bytes > > That doesn't matter one bit. You declare the maximum packet size in your endpoint descriptor. If you make a request larger than that, the USB host controller driver will chop it up into a series of requests of that maximum packet size. If you do get ahead of the device, the FX2 will simply not respond, and the request will retry until data is available. You have to think about how USB works. The USB host controller needs to have the entire frame (1 millisecond) already scheduled by the time the frame starts. If you submit one 512-byte request at a time, you are only going to get one transfer in each frame. But if you submit a 16k-byte request , the host controller chops that into 80 packets, which it can pack into frames just as tightly as it can. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |