Microsoft KB Archive/138895

{|
 * width="100%"|

PRB:Status Error Bit Ignored by Windows 95 Serial Port Driver

 * }

Q138895

-

The information in this article applies to:


 * Microsoft Win32 Device Driver Kit (DDK) Windows 95

-

SYMPTOMS
Under certain rare conditions, the overrun (OR) error, framing error (FE), and parity error (PE) status error bits are momentarily ignored in the Microsoft Windows 95 serial port driver, Serial.vxd. This behavior only affects users expecting "bursts" or packets of information coming into the serial COM ports.

If you are using the standard error reporting simply to notify the user in standard applications, this behavior will probably not affect you.

CAUSE
The bits affected are in the LSR (line status register) in the serial chip. When the Serial.vxd driver determines that data is available and there are currently no errors, it enters a loop clearing the FIFO (first in, first out) buffer. This is a very fast loop which only needs to read a minimum of two bytes or a maximum of seventeen bytes to clear the hardware buffer depending on the type of chip in use. Remember, worst case, one last byte may be clocking in while you are reading another byte. It is assumed that the loop time is easily fast enough to complete before subsequent incoming bytes are ready to be read.

To check for remaining byte(s), the loop reads the LSR, which contains the DR (data ready) bit. The remaining bits are ignored. However, reading the LSR, clears the OR, FE, and PE error bits.

If an error occurs in the brief time on the way to this loop, it is ignored and cleared. There are two cases where this might be a problem if the FIFO triggering is set to the maximum, or if an 8250-style chip is being used. One case occurs during a high speed continuous data transfer just bordering on overrun, where the very first error must be flagged immediately. The other case involves a high speed burst or packet of data, again bordering on overrun where the error occurs just at the end of the transfer so that the one and only error might be missed occasionally.

As you would expect, applications handling any sort of continuing data, not in a burst, quickly get subsequent error codes being reported. Any condition, such as overrun still continues to cause ongoing errors, and at the user level, it is noted by an application.

RESOLUTION
Either of the following steps can be used to correct this behavior:


 * If you are using the maximum FIFO setting, reduce it to give headroom to avoid overrun error possibilities. This relates specifically to overrun, not parity or framing errors.

-or-
 * There is currently no fix or patch available to correct this behavior. However, you can write your own version of the device driver that corrects this problem, after inspecting the Serial example supplied on the Win32 DDK compact disc. In the supplied public Win32 DDK sample, look in Serial.asm, and search for the data_availxx: labels to find the data reading loop. To correct this behavior, add a save location to place the LSR in before masking to get to the DR bit in a similar loop.