Re: serial ports

Theodore Y. Ts'o (tytso@mit.edu)
Tue, 6 Aug 1996 18:51:54 -0400


Date: Tue, 06 Aug 1996 08:12:20 -0500 (EST)
From: "Mark H. Wood" <mwood@mhw.oit.iupui.edu>

But this doesn't explain why the IRQ3 ISR, for example, doesn't drain
both the COM1 and COM3 FIFOs *whenever it is invoked*. (I may have got
the IRQ wrong -- sorry.) If you can't tell which device invoked a shared
interrupt, you try to service them all.

Linux has code for doing this --- that's how things like the AST
Fourport cards, and the BOCA BB-4, BB-8, and BB-16 are handled. BUT,
these are cards that are specially designed to have multiple ports
sharing one interrupt. COM1 and COM3 are not so designed. Secondly,
even if you try to poll all the ports when you get an interrupt, this
doesn't work very well above 12 ports or so. The problem is that in the
time that it takes to scan all 12 ports, a character can come in the
first port, which will get missed, so that when you return from the
interrupt handler, the interrupt for the first port gets missed, and
that first port will start dropping characters.

The problem with why COM1 and COM3 can't share FIFO is electrical, not a
matter of software. The problem is that the UARTS for COM1 and COM3 are
directly driven by the board, and so if both UARTS are active, they end
up fighting for the line. One board will try to force the interrupt
line low, and the other board will force the line high. As a result,
usually what ends up happening is that one board will "win", and you
will only see interrupts from that one board. Or, in some cases,
interrupts will be interrmitent and reliable. In a few cases, it might
actually work, depending on how the motherboard interprets the
(indeterminent) voltage levels that result when two TTL gates are
fighting over a line without a mediating AND gate. Note that you will
be sinking a lot of current when you hook up the output of two TTL gates
together, since you end up with medium-resistance short between +5 volts
and ground. You *probably* won't damage your hardware, but I make no
guarantees....

There is a way you can make COM1 and COM3 operate correctly, but it
involves cutting traces on your motherboard and on your serial board,
and then soldering in either a TTL integrated chip (if you're being
clean), or using two diodes (if you're playing fast and loose with the
hardware). In either case, don't ask me for instructions for how to do
this, because this is something that I will NOT recommend that people
do. I will NOT be responsible for anyone who damages their computer by
attempting to kludge the hardware, and screws up while they are trying
to cut a trace on their motherboard, or soldering a wire to trace on the
motherboard or serial port. (If you don't know what I mean by this,
you don't want to be thinking about doing this kind of modification; if
you do know what I mean, you'll already be extremely hesitent.)

- Ted
"The serial guy" :-)