Hi Tim,
Thanks for your response.
Please find my responses below.
Date: Mon, 7 Nov 2011 12:47:12 -0800
From: xxxxx@probo.com
To: xxxxx@lists.osr.com
Subject: Re: [ntdev] Using USB Continous Reader for continuously reading BULK IN data?
Monisha Barooah wrote:
> Hi Everyone,
> I wanted to know if using the USB Continuous Reader for reading a
> continuous stream of USB BULK IN data from the device is the right
> implementation for reading continuous data received from a device?
It’s kind of an odd question, because that’s exactly what it was
designed for.
By continuous data I meant that data is sent by the device continuously. The USB bus is under full utilization all the time due to the continuous frames sent to the host from the device.
> Our device sends Continuous data to the host across the BULK IN
> endpoint. All of these data is of significance and require host
> processing to be done. With the usage of the Continuous Reader, we
> seem to be experiencing some data loss.
What kind of driver? KMDF? UMDF? WinUSB?
Its a KMDF driver.
> For reading continuous streaming ISO data, the Continuous Reader is
> not used. There is a different mechanism for reading a Continuous
> Streaming ISO data as I saw in the driver samples in WDK.
Right; the continuous reader does not support isochronous pipes because
the packet and buffering formats are different.
Does the other mechanism support reading of BULK IN packets as well?
> The data that we are receiving from our device through the BULK IN
> endpoint is actually Audio data but this data is coming in as BULK IN
> rather then ISO IN due to some limitations in implementation in our
> USB device.
>
> So, the rate at which data is supposed to be coming in the USB Bus is
> equivalent to the rate of the ISO IN data but its just getting
> received through the BULK IN endpoint.
Is this a USB 2.0 device, so bulk packets are 512 bytes? Does your
device send partial packets, or does it wait until it has all 512
bytes? How much data are you producing? How have you configured the
continuous reader?
Its a USB1.1 device having BULK Max sizes of 64 bytes. The devices sends frame sizes of 3136 bytes across the BULK IN endpoint. These are spread across a lot of BULK IN packets of max size 64 bytes.
The following configurations have been done for the contiguous reader:
WDF_USB_CONTINUOUS_READER_CONFIG_INIT(&contReaderConfig,
EvtUsbBulkPipeReadComplete,
DeviceContext, // Context
3136); // TransferLength
contReaderConfig.NumPendingReads = 1; //so that the packets are ordered.
status = WdfUsbTargetPipeConfigContinuousReader(DeviceContext->BulkPipe,
&contReaderConfig);
if (!NT_SUCCESS(status)) {
KdPrint ((" Configuration for Continuous ReaderForvBulk IN EndPoint failed %x\n", status));
return status;
}
Are any more configurations required?
If NumPendingReads is changed to 3, there is still data loss.
> I tried changing the *NumPendingReads *in the
> WDF_USB_CONTINUOUS_READER_CONFIG structure to 3 to increase the data
> rate but looks like it still drops data. Also changing this field does
> not ensure ordered data delivery and we require ordered delivery.
How much user-mode processing are you doing? Are you getting the
buffers turned around fast enough that the reader never runs out?
A queue has been used for the data. The Reader adds the 3136 sized frames to the tail of the queue and schedules a workitem for further processing. In the context of the Workitem, the priority of the thread is increased to 31(Highest priority) and then the workitem fetches data from the head of the queue, does the required processing and sends processed data to user mode applications.
> Is there any way I can achieve data read through the BULK IN endpoint
> at a faster rate as in ISO-IN? Will following the same mechanism as
> reading data from the ISO-IN help get the desired data rate?
As long as you keep feeding empty buffers, there should be no dropouts.
I think there are empty buffers as the queue size is very high and I never observe the queue becoming empty to drop data. Are there are any other internal buffers which the reader uses which needs to be taken care of? Am I programming the reader the correct way? Seems okay to me. But you could give your views.
I believe if on the software side, things are taken care of appropriately, issues could be in the way data is read from the device…maybe we need to read data much more faster. I tried increasing the TransferLength to (3136 * 3) but that kind of slowed down the system and we were still observing data losses. The ISO transfers are periodic transfers and the ISO IN tokens are sent across the USB bus from the host in a periodic manner determined by the USB Host Controller on the Host side. I guess we would need to maintain the same rate of issuing the tokens for the BULK INs as well.
Is there anyway, the data loss can be resolved? Any suggestions?
Thanks
Monisha
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer