Click here to Skip to main content
15,891,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Doc /View Debugging. Pin
Stuart Dootson14-Mar-09 23:40
professionalStuart Dootson14-Mar-09 23:40 
GeneralRe: Doc /View Debugging. Pin
grassrootkit15-Mar-09 0:02
grassrootkit15-Mar-09 0:02 
QuestionRe: Doc /View Debugging. Pin
grassrootkit15-Mar-09 0:36
grassrootkit15-Mar-09 0:36 
AnswerRe: Doc /View Debugging. Pin
Stuart Dootson15-Mar-09 0:45
professionalStuart Dootson15-Mar-09 0:45 
GeneralRe: Doc /View Debugging. Pin
grassrootkit15-Mar-09 1:13
grassrootkit15-Mar-09 1:13 
GeneralRe: Doc /View Debugging. Pin
Stuart Dootson15-Mar-09 1:39
professionalStuart Dootson15-Mar-09 1:39 
QuestionActiveX call OLEDraw to draw Flash(swf) Pin
l_arrow14-Mar-09 18:28
l_arrow14-Mar-09 18:28 
QuestionSerial port read latency (SERIOUS - NEED HELP FAST!) Pin
PeniWize14-Mar-09 14:24
PeniWize14-Mar-09 14:24 
Hello everyone,

I’ve got a serious problem that is killing our product and requires an immediate solution. Our situation is CRITICAL!

We have implemented support for a real-time serial protocol in our Windows XP Embedded based device. It uses a regular 16550 based UART/COM port on the motherboard and the following settings: 19.2Kbps, space parity, one stop bit, and eight data bits. The COM port is configured with COMMTIMEOUTS = { 5, 0, 0, 0, 0 }. The machine contains a 1.6GHz Celeron M processor and 1GB or RAM, which is not completely used.

The protocol requires our embedded device to respond to a packet within 20ms so it is imperative that our process receive the packet from the kernel (serial.sys) as fast as possible. The end of a packet is identified by 5ms or more passing between bytes. We’ve implemented several different solutions using both synchronous and overlapped I/O and have determined that the most reliable way to get the data as fast as possible is to start up a read thread with real-time priority and invoke ClearCommError() at 5ms intervals while tracking the amount of data in the receive buffer with COMSTAT. cbInQue. When the amount of data does not change for 5ms we call ReadFile() to obtain it. This solution seems to work fairly well for a few minutes and then suddenly ReadFile() begins returning the data after 100ms or more instead of the 10ms-15ms it was previously. It’s also returning the data in non-contiguous fragments even though our serial line monitor shows that the data is being sent to our device in one solid block (that never exceeds 260 bytes and is usually 32-48 bytes). The only “solution” we’ve found so far is to shutdown and restart the process. We’ve even tried having the process close and reopen the port with no success.

I’ve considered modifying serial.sys to automatically handle packet reception at the device level, but I’m concerned that it wouldn’t solve the problem because it appears to be a latency issue coming from somewhere other than the driver. The protocol code is very large and complex so moving it into a driver is so undesirable that we will probably move to embedded Linux instead (if it’s necessary).

Please help!

Thanks,
Peni
AnswerRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Luc Pattyn14-Mar-09 15:21
sitebuilderLuc Pattyn14-Mar-09 15:21 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
PeniWize14-Mar-09 20:48
PeniWize14-Mar-09 20:48 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Luc Pattyn15-Mar-09 4:49
sitebuilderLuc Pattyn15-Mar-09 4:49 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
PeniWize15-Mar-09 10:13
PeniWize15-Mar-09 10:13 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
CPallini14-Mar-09 23:59
mveCPallini14-Mar-09 23:59 
AnswerRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Stuart Dootson14-Mar-09 19:24
professionalStuart Dootson14-Mar-09 19:24 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
PeniWize14-Mar-09 20:55
PeniWize14-Mar-09 20:55 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Stuart Dootson14-Mar-09 23:19
professionalStuart Dootson14-Mar-09 23:19 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
grassrootkit14-Mar-09 23:29
grassrootkit14-Mar-09 23:29 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Stuart Dootson14-Mar-09 23:44
professionalStuart Dootson14-Mar-09 23:44 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
PeniWize15-Mar-09 9:59
PeniWize15-Mar-09 9:59 
GeneralRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
grassrootkit14-Mar-09 20:56
grassrootkit14-Mar-09 20:56 
AnswerRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Trollslayer15-Mar-09 4:06
mentorTrollslayer15-Mar-09 4:06 
AnswerRe: Serial port read latency (SERIOUS - NEED HELP FAST!) Pin
Joe Woodbury15-Mar-09 17:42
professionalJoe Woodbury15-Mar-09 17:42 
Questionwin32 programming - How to use multiple colors in the same line of text? Pin
Member 294013214-Mar-09 12:14
Member 294013214-Mar-09 12:14 
AnswerRe: win32 programming - How to use multiple colors in the same line of text? Pin
Stuart Dootson14-Mar-09 12:35
professionalStuart Dootson14-Mar-09 12:35 
AnswerRe: win32 programming - How to use multiple colors in the same line of text? Pin
Code-o-mat14-Mar-09 13:05
Code-o-mat14-Mar-09 13:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.