On Sun, Jun 18, 2006 at 08:56:31AM -0700, Kiran Bacche wrote:
Yes, my kernel mode polling did not help. Also I tried setting the
application priority to “real-time” via Task manager interface. But
still it is not really “real-time”.
And it never will be, unfortunately…
As a final resort, Im planning to write my own USB driver replacing the
ser2pl.sys USB driver that came with the USB-to-serial adapter.
As soon as the DCD changes state, the USB-2-Serial adapter sends a USB
interrupt transfer packet. This is behaviour of the device.
Well, not really… I’ll explain in a moment.
I think the windows USB subsystem would get this packet asynchronously
(via interrupt) and then disptach it asynchronously to the appropriate
upper device driver depending on the device id. Right ?
No. This is a common misunderstanding, and it is one which derives directly
from the somewhat misleading term “interrupt pipe”.
There is no such thing as an asynchronous transfer in USB, and an interrupt
pipe does not actually interrupt the processor. USB is ENTIRELY a host-
driven protocol. A device is not permitted to send anything unless and
until the host has asked it for data.
In the case of an interrupt pipe, the host is only going to ask the
device once every N frames, where N is specified in the device’s
descriptors. Further, the host will not send a request at all unless
a driver has queued up a read request by the time the frame starts. If
there is no read request, then the device will never get the chance to
send.
Now can somebody point me to a sample USB device driver with
callbacks invoked when “interrupt transfer packets” arrive from a USB
device ?
USB does not work that way. You have to keep sending read requests in
order for the device to send. When the driver gets the packet, it has
to turn right around and submit another read URB so the host controller
will send an IN token to the device.
So, as you can see, these USB-to-RS232 converters are NOT real-time in
the traditional sense. You probably won’t be able to do much better
than your user-mode app.