From: Tim R. <ti...@pr...> - 2008-08-11 17:57:06
|
Jeffrey Price wrote: > > on the device i am using, you set the analog-to-digital sample > frequency up to 500Khz (500k samples/second) before you start to read > the samples > > what i am seeing is that bulk_read call times out when the clock > speed increases beyond about 200Khz, or at a lower clock speed as the > volume of data requested grows; a number of reads successfully > complete; sometimes most of the data is read, before the timeout > occurs on the last reads required, or so > > I am now claiming the interface and then just calling bulk_read() in a > loop, until all the requested data is read. I have tried using > nanosleep() with up to 1ms delay before successive calls to bulk_read > to not hog the processor as well. > Try making the buffer in your bulk_read much larger. If the problem is that you aren't turning around quick enough, that will help. > the USB part in the device is the Cypress Easy-Usb FX2LP. I wonder if > I cannot empty the FIFO in the part fast enough. I am not sure what > happens when the FIFO gets full in the part, or my device. i know > there is no buffer between my device's A/D converter and the FX2LP part. > When the FIFO fills, additional samples get dropped on the floor. If you are reading 512 bytes at a time, you won't be able to keep up at 500kHz. Remember that USB is scheduled in advance. The host controller driver lays out the schedule for the next microframe in advance. If you only have one request waiting, you'll only get one shot in that microframe. When the request is filled, you'll get notified, at which point you have to do your processing and send the request back. By that time, you will have missed the scheduling for the next microframe. Make larger requests, and then the host controller can fill up more of the frame. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |