Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!unido!rwthinf!franke From: franke@rwthinf.UUCP (Christian Franke) Newsgroups: comp.sys.ibm.pc Subject: Re: HELP! Interrupts on COM ports Summary: Final solution Keywords: COM port, Interrupt, Device Driver Message-ID: <1239@rwthinf.UUCP> Date: 31 Jul 89 14:07:23 GMT References: <1137@rwthinf.UUCP> Organization: RBI - RWTH Aachen Lines: 68 In article <1137@rwthinf.UUCP>, I [franke@rwthinf.UUCP (Christian Franke)] wrote: > > I've written a interrupt driver for the COM{12} ports of an AT. > If the receiver side uses interrupts and the transmitter side uses polling, > everything is OK. > If the transmitter uses interrupts also, the following problem occurs: > > When the transmitter and the receiver interrupts occur simultaneously, then > sometimes the transmitter interrupt is lost: The IIR register of the > 8250 does not report "Transmitter empty interrupt" after the > "Receiver data available interrupt" has been processed. > Both (8250 internal) interrupts should occur during the same hardware > interrupt cycle of the 8259. > After this situation, the LSR of the 8250 correctly reports > "transmitter ready" (bit 5). > > [remaining stuff deleted] > Thanks to all who answered. I've found the solution last week. The behaviour seems to be a problem in some COM12/LPT12 cards from taiwan. These cards don't have a real 8250 for serial i/o but a custom chip named CTC83747 for serial and parallel i/o. I could not reproduce the error with our V24/V11 card, which has a fast 8250 (up to 115200 baud) on it. With a special test routine, I was able to trace the error: The following situation occurs sometimes when transmitter & receiver interrupt occur nearly simultaneously: Action Data Comment ========================================================================= ComInterrupt: Start of interrupt routine Read LSR **0****1 Transmitter busy, receiver ready Read IIR ****0100 Receiver Interrupt (ok) Read RBR ******** Received character read (ok) Read LSR **1****0 Transmitter changed to ready Read IIR ****0000 Modem status interrupt (disabled!) should be ****0010 ! Read MSR ****0000 No modem status changes ! Read IIR ****0001 No interrupt pending now, transmitter interrupt lost. Write ICC 00100000 Say 8259: EOI RTI End of interrupt routine The LSR reads are not necessary to reproduce this error. The IER is set to 00000011 (only transmitter & receiver interrupt enabled). The error does not depend on the baud rate (checked with 300-19200 Baud). In order to overcome this problem, it is necessary to loop on the Transmitter Empty bit in the LSR when the IIR says "No interrupt". Regards, Christian Franke Aachen University of Technology Lehrstuhl fuer Informatik I Ahornstrasse 55 D-5100 Aachen Federal Republic of Germany Tel.: 0241 / 80-3586 UUCP: franke@rwthinf.uucp ({...mcvax}!unido!rwthinf!franke)