Re: Polling Thread, Where to locate?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Randy Aull \(MSFT\) (randyau_at_microsoft.com)
Date: 09/13/04


Date: Mon, 13 Sep 2004 13:45:48 -0700

As others have stated, an Interrupt endpoint may be more suitable if latency
is a concern. Do keep in mind that maximum data throughput is lower on
interrupt than bulk, but bulk has no guarantees.

You should change your device to NAK instead of respond with 0 bytes. This
is standard USB endpoint behavior. If you change this behavior then you can
actually pend more than one URB if you would like in order help maximize
throughput, as there would always be a read pending and your device will be
polled as frequently as possible. The URBs will complete when they either
receive all of the requested data, or there is a short (or zero-length)
packet.

If your device is receiving data up to 100 MBytes/Sec, you may have some
troubles. Over USB 2.0 hi-speed bulk endpoints, the max data rate that I
have ever been able to achieve is almost 40MBytes/Sec. That pretty much
saturates all USB bandwidth. So your device is going to need a buffer large
enough to hold your maximum burst time unless you want to drop data.

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dennis Burns" <dburns@rtessentials.com> wrote in message 
news:uSoNrKJjEHA.2908@TK2MSFTNGP10.phx.gbl...
> Hi Randy,
> Thanks for the response.
> I have full control over the device's response protocol. I have written 
> the
> firmware so that if there is no data to send, it will respond with 0 
> bytes,
> but I can change that so that it would NAK instead.
> The device has only 1024 bytes of buffer space, so if data is coming fast
> (up to 100 MByte/Sec ), then I need to pull the data pretty quickly.
> Please elaborate a bit on your idea. I think you might have a much better
> way to handle this.
> By the way, this is a CAN to USB interface device. The CAN network data 
> can
> be up to 1Mbit/sec, but the rate is pretty bursty.
> Thanks,
> Dennis
>
> "Randy Aull (MSFT)" <randyau@microsoft.com> wrote in message
> news:412f7aa9$1@news.microsoft.com...
>> Is there a reason you don't want to simply pend a read that will complete
>> when the device responds?  Does your device actually send data over bulk
> to
>> NAK at your protocol level?
>>
>> While pending a read may take up more bus bandwidth, it will use much 
>> less
>> CPU.  You can even pend multiple reads in order to achieve your high data
>> rate.
>>
>> Randy
>>
>> -- 
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>> "Dennis Burns" <dburns@rtessentials.com> wrote in message
>> news:ekrbS4FjEHA.2556@TK2MSFTNGP10.phx.gbl...
>> > I'd like to implement a polling thread to periodically read data (via a
>> > Bulk
>> > Transfer) from my USB device, and save that data into a buffer until my
>> > application gets time to use it. I can implement this thread in either
> my
>> > kernel mode driver, or in my user mode api. Under high loading
> conditions,
>> > I
>> > may need to run  this loop at a pretty high rate (up to every 10 ms, if
>> > that's achievable).
>> > Is there a clear advantage to where it's located: kernel vs user? For
>> > example, will the kernel-mode choice be guaranteed higher priority? Or,
>> > are
>> > there are other reasons to choose one over the other?
>> > Thanks in advance for the help,
>> > Dennis
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • USB bus switches transfer mode unexpected
    ... I have a problem with an USB printer that is sending status data back to the ... An ISO is transfer is similar to a BULK transfer with the exception of block ... An Endpoint can be described as a channel in the USB stream and are ...
    (microsoft.public.development.device.drivers)
  • Re: NAK, NAK, NAK Bulk IN
    ... Instead of NAKing the Bulk In request, return it with a zero length packet. ... See USB Spec. ... I originally had this endpoint configured as an Interrupt ...
    (microsoft.public.development.device.drivers)
  • Re: HID Multitouch Digitiazer driver samples
    ... I'm don't use bulk, because, somehow, the results are not so pleasing, maybe ... With my best regards, ... Suppose that I want to use USB isoc transfers, ... How is isoch traffic implemented on a serial communication? ...
    (microsoft.public.development.device.drivers)
  • USBEHCI.SYS bug with high-bandwidth interrupt endpoints
    ... I was investigating USB 2.0 high-bandwidth interrupt ... three transactions per microframe with a maximum packet size of 1024 ... bytes in the endpoint descriptor. ...
    (microsoft.public.development.device.drivers)
  • Re: Unipod with Nokia 7250i - Anyone drivers ?
    ... if the phone presents its contents as one of the standard USB mass ... Configuration has 1 interfaces ... Endpoint number 1 (device to host) ...
    (comp.sys.acorn.hardware)