Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Serial write blocks

Reply
Thread Tools Display Modes

Serial write blocks

 
 
Rob
Guest
Posts: n/a

 
      06-24-2008
Hi,
I am developing an application that does constant serial communication.
The application is closely guarded for looptimes and hanging threads.
I noticed that my commu-thread ofter hangs, or reports long looptimes.

This thread writes to the comport.
All Write timeouts are set to 0 (not used).
Another thread is continuously reading from the port.
This can be done at the same time right ? (read/write I mean).
I know enough about uarts to know they can do it, but I don't know if the
win32 api has it's own idea's about this. (note that actually I'm using a
virtual USB comport).

I am using regular WriteFile()/Readfile(), and SetCommTimeouts().
What could be the problem with the long write times ? (or even hangups)
Maybe the virtual comport driver is to blame ?
I never saw this behaviour on regular comports.

Greetings,
Rob.
















 
Reply With Quote
 
 
 
 
chris.aseltine@gmail.com
Guest
Posts: n/a

 
      06-24-2008
On Jun 24, 4:31 am, Rob <R...@discussions.microsoft.com> wrote:

> I noticed that my commu-thread ofter hangs, or reports long looptimes.
>
> I am using regular WriteFile()/Readfile(), and SetCommTimeouts().
> What could be the problem with the long write times ? (or even hangups)
> Maybe the virtual comport driver is to blame ?


Does the virtual COM port driver offer any logging abilities? That
would shed a lot of light on the situation. Also, you say it's a USB
device -- is it possible the device is NAKing the transfer from the
driver? Have you checked with a bus analyzer or a lower filter to the
COM port driver?
 
Reply With Quote
 
Rob
Guest
Posts: n/a

 
      06-24-2008
Hi Chris,
Let me guess, you just happen to have a driver with such facility's ;-)

I have not debugged any further then from my application.
For now I'm just curious if this can be considderred normal behaviour under
certain conditions.

I read the following which worries me (and is news to me) :
http://msdn.microsoft.com/en-us/library/ms810467.aspx
Under the "non-overlapped-IO" part it says that a write would block if a
read is active. That is not true as far as I know, but maybe I am wrong ?.

My app will run under WinCE, but for testing XP would be nice.
So not worth wasting too much time on.
Especially since they did not decide on which driver to buy yet ;-)

Anyway , my read should take max 200ms (I expect +/- 50%) , sometimes the
thread hangs up completely , or for 3500ms, so thats no good anyway, blocking
or no blocking.
Might be just a bug in the driver (the other one...).

Greetings,
Rob
















"" wrote:

> On Jun 24, 4:31 am, Rob <R...@discussions.microsoft.com> wrote:
>
> > I noticed that my commu-thread ofter hangs, or reports long looptimes.
> >
> > I am using regular WriteFile()/Readfile(), and SetCommTimeouts().
> > What could be the problem with the long write times ? (or even hangups)
> > Maybe the virtual comport driver is to blame ?

>
> Does the virtual COM port driver offer any logging abilities? That
> would shed a lot of light on the situation. Also, you say it's a USB
> device -- is it possible the device is NAKing the transfer from the
> driver? Have you checked with a bus analyzer or a lower filter to the
> COM port driver?
>

 
Reply With Quote
 
chris.aseltine@gmail.com
Guest
Posts: n/a

 
      06-24-2008
On Jun 24, 8:46 am, Rob <R...@discussions.microsoft.com> wrote:

> Let me guess, you just happen to have a driver with such facility's ;-)


Well...

> I read the following which worries me (and is news to me) :http://msdn.microsoft.com/en-us/library/ms810467.aspx
> Under the "non-overlapped-IO" part it says that a write would block if a
> read is active. That is not true as far as I know, but maybe I am wrong ?.


No, I think that's actually correct. Indeed, if you want to do writes
and reads at the same time on a single handle, I'm fairly certain you
need to open the handle as FILE_FLAG_OVERLAPPED and then use
overlapped I/O.

See also: http://www.osronline.com/showThread.cfm?link=130884
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adaption of serial.sys for sub-millisecond timing resolution on serial port Luke \(may the source be with you\) Windows Vista Drivers 5 2 Weeks Ago 07:06 PM
how to write a serial port driver (UART 0) COM Port shashank Windows Vista Drivers 2 03-29-2008 04:06 PM
The disk is write-protected. Remove the write-protection or... Craig H. Foster Windows Vista General Discussion 0 09-16-2007 04:02 PM
Install custom serial port driver without removing serial.sys Luke \(may the source be with you\) Windows Vista Drivers 13 02-21-2006 08:00 PM
How to write program for Serial and USB which connect to hardware? Tom Windows Vista Drivers 1 10-14-2004 10:24 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59