Tim Roberts wrote:
> But I have faced other problem.
> If I start any heavy application I see that sometimes the host has not time to
> take away the data from the device. The internal buffer of the device is
> overflowed, and it is inadmissible. Device is analog-to-digital converter.Where are you getting the buffers now? Are you waiting for a user-mode
app to send you buffers?
Are you submitting one URB, then processing it and resubmitting?
I don’t submit one URB. I submit 16 IRPs from my user-mode application. Driver transforms this 16 IRPs to 16 IRP-URBs. When IRP have completed, I submit next IRP from application. I support queue of length 16 between the application and the Host Controller driver.
I think, I lose samples in heavy loaded system because the driver and the application will be executed in different (PASSIVE LEVEL) threads. There is a situation when the Host Controller Driver has already processed queue from 16 URB and the application thread yet has not started to be dispatched. Result: URB queue for Host Controller Driver is empty and the ISO-exchange is not planned for the next microframe -> device buffer overflows.
Nobody is insured from this situation in non-realtime OS.
If I change the design and I will submit packages directly from Completion Routine, whether that I will avoid this situation? Or this method does not give 100 % guarantee that samples will be taken away from the device on very-very heavy loaded Windows.
Why you advise to support queue from 8 URBs to Host Controller Driver, there is theoretically enough queue from one or two URBs?
You need to “do the math” to match your device’s needs with the interval
for the endpoint. What is the continuous and the peak data rate? What
do you have the isochronous interval set to? If your peak data rate is
no more than 1 MB/second, for example, then an interval of once every 8
microframes should keep up, but you might set it to every 4 microframes
just in case. You almost have to run a simulation to figure out the
worst case. You get a shot to transmit one packet during your isoch
interval. After that, USB won’t talk to you AT ALL until your next
interval. If your FIFO is going to overflow by that time, then you need
to decrease the interval.
My Device Produce Data has speed 1000*8184 = 8.184.000 Bytes/Sec
I set pooling interval pipe descriptor to 1 (Every Microframe) and set 1 ISO packet per microframe. 8000*1024 = 8.192.000
If the CRC is invalid in an isochronous packet, the packet will be
dropped. As I said, this never happens in real life.
What status will i receive If the CRC is invalid? What value of “Length” field will i receive If CRC is invalid?