From: Asaf Shelly on
Hi All,

I have a driver using COM port internally. I need accurate read timing so I
am reading bytes one by one.
I start with reading a single byte and on read completion I am sending
another request for the next byte.
The flow of execution is so that if there are a few bytes pending every read
will complete immediately before function return, like this:

Two Single Bytes:
Read (1)
Read (1) Completion invoked
- Read (2)
Read (1) Completion done
Read (2) Completion invoked
- Read (3)
Read (2) Completion done

Multiple Bytes pending:
Read (1)
Read (1) Completion invoked
- Read (2)
- Read (2) Completion invoked
- Read (3)
- - Read (3) Completion invoked
- - - Read (4)
- - - Read (4) Completion invoked
- - - - Read (5)
- - - Read (4) Completion done
- - Read (3) Completion done
- Read (2) Completion done
Read (1) Completion done

When I have about 30 bytes pending the system will reset / hang. I'm using
Virtual PC with Windows XP SP2.

Any solution / design methodology are welcome.

TIA,
Asaf
From: Pavel A. on
Just off top of my head... try VMware Workstation.
It also has a nice replay feature and other goodies fore debugging, though
I'm not sure how exactly to apply them for your situation.
Do you forward requests to serial.sys or acess the registers directly?
-- pa


"Asaf Shelly" <MSMediaForum(a)Shelly.co.il> wrote in message
news:DA949373-32BC-4DC5-80E0-F41EFB6913D5(a)microsoft.com...
> Hi All,
>
> I have a driver using COM port internally. I need accurate read timing so
> I
> am reading bytes one by one.
> I start with reading a single byte and on read completion I am sending
> another request for the next byte.
> The flow of execution is so that if there are a few bytes pending every
> read
> will complete immediately before function return, like this:
>
> Two Single Bytes:
> Read (1)
> Read (1) Completion invoked
> - Read (2)
> Read (1) Completion done
> Read (2) Completion invoked
> - Read (3)
> Read (2) Completion done
>
> Multiple Bytes pending:
> Read (1)
> Read (1) Completion invoked
> - Read (2)
> - Read (2) Completion invoked
> - Read (3)
> - - Read (3) Completion invoked
> - - - Read (4)
> - - - Read (4) Completion invoked
> - - - - Read (5)
> - - - Read (4) Completion done
> - - Read (3) Completion done
> - Read (2) Completion done
> Read (1) Completion done
>
> When I have about 30 bytes pending the system will reset / hang. I'm using
> Virtual PC with Windows XP SP2.
>
> Any solution / design methodology are welcome.
>
> TIA,
> Asaf

From: Asaf Shelly on
"Pavel A." wrote:
> Do you forward requests to serial.sys or acess the registers directly?

I am using "DosDevices\COM1" because I have to support hardware
implementations different than on-board RS232

It sounds to me like a stack overflow or flooded queue

Asaf
From: Asaf Shelly on
Never mind that.
The solution was to have read-completion queue a DPC which will issue the
next read.

Asaf
From: Maxim S. Shatskih on
> A communication frame can end by silent period.

Send an end-of-talk marker instead.

The normal, logical and well-supported COM port use is that only _bits within a byte_ have the guaranteed timing (baud rate), and no timings between _any two_ bytes are guaranteed.

I do not say other uses are not possible, but they are _very much problematic_, especially in a multitasking OSes.

> As long as it works, I can deploy it to a real system

I have doubts you can even debug such realtime hardware-oriented code on a VM.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com