Re: Highly responsive serial port

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



In addition to other replies:
Note that read request to the serial driver can be completed
by reading specified number of bytes, or by timeout.
In it's turn, the resolution of these timeouts is same as the
system clock resolution.
So, you either don't want to rely on timeouts (design your protocol
so that request can be completed by reading exact number of bytes)
or set the minimum possible timer resolution (which may be ~ 2ms)
and use short timeouts.
Giving your process realtime priority is pointless
without this, because what holds your process is waiting for
i/o completion, not other processes.

Also, for real time serial protocols I'd warmly recommend
a cheap programmable microcontroller, connected to PC
over USB, ethernet or even serial port (not in real-time, of course).

Regards,
--PA


Arkej wrote:
Hello,
before I dive into the world of kernel mode drivers I'd like to know:
My problem consists of reading from a serial COM port as fluent as possible(real-time like). It looks like it is not doable in user mode. If due to scheduling of threads my reader thread doesn't get enough time I have a delay of read on the input. Let's say I have to process data coming every 30ms and then reply in 20ms. If my reader only reads the input buffer after 50ms I'm too late to reply but I don't know it.
1. Would a driver(in kernel mode) have enough priority to process such requests in time?
2. Is there any other way in user mode to assure constant read of serial port?

Thanks
Robert


.



Relevant Pages

  • Re: Highly responsive serial port
    ... That's all I do with timeouts. ... by reading specified number of bytes, ... over USB, ethernet or even serial port. ... Would a driver(in kernel mode) have enough priority to process such ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Does anyone know of an object compatible (non static) way of setting timeouts on VMS?
    ... > timeouts within VMS. ... Both the system command 'sys$setimr' and the X ... AST that you can use as you wish. ... You need to map the request id ...
    (comp.os.vms)
  • Re: pyserial and com port interrupts
    ... as opposed to polling and timeouts? ... Have you looked into letting the OS do it? ... I.e., reading from COM4: ...
    (comp.lang.python)
  • Re: ata driver.
    ... > Writing to all drivers works with dma on. ... Reading causes timeouts. ... Okay, sounds somewhat familiar. ...
    (freebsd-questions)
  • Re: Highly responsive serial port
    ... What I did in my test with timeouts was to set ReadIntervalTimout = MAXDWORD to make a call to Readfile function return immediately. ... That's all I do with timeouts. ... Would a driver(in kernel mode) have enough priority to process such requests in time? ... Is there any other way in user mode to assure constant read of serial port? ...
    (microsoft.public.win32.programmer.kernel)