From: jeffp <jm...@ya...> - 2008-08-20 17:39:04
|
Thanks Alan, and Tim, After this discussion I think that as you suggest moving to libusb 1.0 and using asynchronous processing is the best thing to do. I also just learned that that is how the windows driver that talks to the device works. I will read the docs on 1.0 and see how hard it will be to convert my application Can an application use both 0.1 and 1.0 at the same time ? I have lot's of code that uses 0.1 for control transfers, and although it would be best to convert everything to 1.0 to be clean and consistent, due to tight schedule and budget constraints... could I just use the async bulk reads from 1.0 ? Thanks again jeffp wrote: > > Hi, > > I have posted about this before but am still stuck and unable to make > progress. I do not want to go to my client and say I cannot provide a > Linux USB interface for his device that works at full speed. > > I am running libusb 0.1 under SuseLinux 10.2 and have an application that > uses libusb to talk to my clients analog to digital converter to collect > the converted samples over the usb interface. > > You can specify the speed which samples can be taken from 1/sec up to 500K > / sec. > > I open the interface and claim the device and then in a loop just call > bulk read passing in a very large buffer (larger than the number of > samples i expect to get), and requesting a very large number of bytes to > be read. For example if I want to collect 500K samples, I use a 2Mb buffer > and specificy 500000 as the number of bytes to read. > > What I am seeing is that beyond a certain speed (seems to be around 100K > samples/sec) > the bulk_read cannot empty the FIFO in the USB part (EASY-USB,FX2LP) fast > enough. Data arrives at the FIFO from the device faster than it can be > read out by bulk read. I think what may be happening is that when the FIFO > overflows the data is dropped on the floor, and the bulk_read only reads > what has not overflowed, which is not equal to the requested amount so it > times out waiting for the data which has probably overflowed. I see > evidence of this when using a sniffer because I see the data being > returned and then before all the data is returned the IN packets result in > NAKs from the device meaning it has nothing more to send. So I think the > missing data is what dropped on the floor at the FIFO. > > The faster I set the sample rate, the worse the problem becomes. > > I thought that libusb and the host controller could handle the high speed > usb at full rate and my application is well below that. Max of 500K > Megabytes / sec which is about 4Megabits per second. Again my application > is doing nothing other than the bulk read in a loop; no other processing > is performed. > > I am not sure, but I think the bulk-endpoint in the part is 512bytes. > > As a final note, the vendor has a Windows usb driver that can accept the > samples at the full rate. > > Tim gave me some useful insight on this last week but I am still not able > to get it to work. > Does anyone have any ideas of what may be happening and more importantly > what I may try to fix it ? > > Thank You very much for your time and help. > > Jeff P > -- View this message in context: http://www.nabble.com/is-libusb-fast-enough-for-my-device-tp19022024p19074549.html Sent from the LibUSB Dev mailing list archive at Nabble.com. |