[comp.dcom.modems] UARTS for speed...

cyamamot@kilroy.jpl.nasa.gov (Cliff Yamamoto) (11/21/90)

Greetings!

I've been running my serial line at 38.4Kbaud on my 386 clone for a few
weeks now without any problems (not running Windows or Deskview).  However,
I've heard that one can change the UART to offload some work on the CPU.

Can anyone tell me if the 8250, the 16450 and the 16550A are pin-for-pin
interchangable?  I'm not sure if I have the 8250 or the 16450, but I'd like
to eventually plug in a 16550A.  Also do all three share the same port and
programming characteristics?  Are 16550A readily available?

Thanks,
Cliff Yamamoto
-------------------------------------------------------------------------------
USnail: Clifford K. Yamamoto - KA6JRG  | Email:  cyamamot@kilroy.jpl.nasa.gov
        Jet Propelled La-bore-atore-ee |         cyamamot@grissom.jpl.nasa.gov
        4800 Oak Grove Drive           |         cky@hydra.jpl.nasa.gov
        M/S 238-737, Section 333       |         cyamamot@devvax.jpl.nasa.gov
        Pasadena, Calif.  91109        |         cyamamot@jato.jpl.nasa.gov
---------------------------------------+---------------------------------------
MaBell: (818) 354-1242 - off.   (818) 354-6042 - alt.   (818) 354-6426 - lab.

jjj@blob.hut.fi (Joni Jaakko J{rvenkyl{) (11/22/90)

In article <1990Nov21.145421.23315@elroy.jpl.nasa.gov> cyamamot@kilroy.jpl.nasa.gov (Cliff Yamamoto) writes:
>I've been running my serial line at 38.4Kbaud on my 386 clone for a few

>Can anyone tell me if the 8250, the 16450 and the 16550A are pin-for-pin
>interchangable?  I'm not sure if I have the 8250 or the 16450, but I'd like
>to eventually plug in a 16550A.  Also do all three share the same port and
>programming characteristics?  Are 16550A readily available?

Yes they are interchangeable.

You do NOT want a 16550AN to a 386 clone when running at 38.4, but you DO
want a 16550AFN. THat F stands there for Fast.

Ok, that is high-end a??hole talk, but anyway, there is a difference between
AN and AFN. And when you can get 16550AFN for about 15$ there's no reason
for not buying it.

--
jjj@niksula.hut.fi
jjj@otax.tky.hut.fi

fire me, fire					until you die

grege@gold.gvg.tek.com (Greg Ebert) (11/22/90)

 cyamamot@kilroy.jpl.nasa.gov (Cliff Yamamoto) writes:
> [...]
>Can anyone tell me if the 8250, the 16450 and the 16550A are pin-for-pin
>interchangable?  I'm not sure if I have the 8250 or the 16450, but I'd like
>to eventually plug in a 16550A.  Also do all three share the same port and
>programming characteristics?  Are 16550A readily available?
>

The 8250 and 16450 are pin interchangeable, and the 16450 is an 'enhanced'
version of the 8250. I dunno what the enhancements are.

The 16550 is *NOT* pin compatible (but quite close). It is upward-compatible
from a software viewpoint from the 16450; you have to enable the FIFO mode.
If you want to install a 16550, you need to rework pins 24 (CSOUT on 16450,
TXRDY on 16550) and 29 (NC on 16450, RXRDY on 16550). These pins show FIFO
status.

You can get all 3 from Jameco.

A comment on the 16550: It's a *NEAT* chip. The FIFOs really cut down on
interrupt overhead, especially at high data rates.


----- Boycott redwood products ---------------------------- Recycle -----
                                                                 #####
{uunet!tektronix!gold!grege}     Register to vote, then        ##  |  ##
grege@gold.gvg.tek.com           vote responsibly             #    |    #
							      #   /|\   #
Support high oil prices, waste tax $$ on war, evade domestic   #/  |  \#
problems, and die young on foreign soil- Just say YES to Bush   #######

root@zswamp.fidonet.org (Geoffrey Welsh) (11/23/90)

Cliff Yamamoto (cyamamot@kilroy.jpl.nasa.gov ) wrote:

 >I've been running my serial line at 38.4Kbaud on my 386 clone for a few
 >weeks now without any problems (not running Windows or Deskview).  However,
 >I've heard that one can change the UART to offload some work on the CPU.

   It may look like I'm contradicting what I said before (specifically, that a 
16550 won't help anyone who's not already having problems with an 8250 or 
16450) but I'm not, really:

   The 16550 will let you trigger receive interrupts at various receive FIFO 
levels (up to 14 bytes) and write up to 16 bytes when the transmit FIFO is 
empty. So... *IF* the software is configured to do it, installing a 16550 
*can* reduce CPU overhead slightly.

   However, you won't feel the difference. (That's why I'm not really 
contradicting what I said before).

 >Can anyone tell me if the 8250, the 16450 and the 16550A are pin-for-pin
 >interchangable?  I'm not sure if I have the 8250 or the 16450, but I'd like
 >to eventually plug in a 16550A.  Also do all three share the same port and
 >programming characteristics?  Are 16550A readily available?

   All three are pin compatible. The 16550 powers up in 16450 mode, for all 
programming intents identical to to the 8250. To activate the FIFOs, you write 
to a read-only status register. I'd like to give full specs, but Matthew 
Desmond (matt@spinq.uucp for flaming purposes) has my National datasheets.

   Here's a quick DOS Turbo Pascal program I hacked together to enable the 
FIFOs on a 16550 and set the trigger level to 1 byte (which won't lower your 
overhead but it will make sure that you stop losing incoming bytes):

PROGRAM NS16550A;

VAR
   address: ARRAY[ 1 .. 4 ] OF word;
   portnum: integer;
   temp: string;

BEGIN
   WriteLn;
   WriteLn('NS16550A Buffer Control ((C)) 1989, 1990
            by Geoffrey Welsh, v901010');
   WriteLn;
   address[1] := $3fa;
   address[2] := $2fa;
   address[3] := $3ea;
   address[4] := $2ea;
   IF ParamCount = 0 THEN BEGIN
      WriteLn('Enables or disables FIFO buffering on a specific COM port');
      WriteLn;
      WriteLn('USAGE: NS16550A COM{1|2|3|4} {ON|OFF}')
      END { IF ParamCount }
   ELSE BEGIN
      temp := Copy( ParamStr(1), 4, 1 );
      portnum := Ord( temp[1] ) - 48;
      IF (portnum < 1) OR (portnum > 4) OR (Length( ParamStr(1) ) <> 4) THEN
         WriteLn('Improper port # given')
      ELSE BEGIN
         IF (ParamStr(2) = 'on') OR (ParamStr(2) = 'ON') THEN BEGIN
            WriteLn('Enabling buffer...');
            Port[ address[ portnum ] ] := 1;
            IF Port[ address[ portnum] ] < 64 THEN
               WriteLn('There doesn''t seem to be a 16550 at COM',
                        temp[1], '!')
            END
         ELSE IF (ParamStr(2) = 'off') OR (ParamStr(2) = 'OFF') THEN BEGIN
            WriteLn('Disabling buffer...');
            Port[ address[ portnum ] ] := 0
            END
         ELSE
            WriteLn('Improper on/off instruction given.')
         END { IF portnum ELSE }
      END { IF ParamCount ELSE }
END.

   If you're serious about lowering your overhead, you might want to invest in 
a smart serial card. Mind you, they're a lot more expensive that 16550s 
(hundreds of bucks vs. $25!)

 

--  
UUCP:     watmath!xenitec!zswamp!root | 602-66 Mooregate Crescent
Internet: root@zswamp.fidonet.org     | Kitchener, Ontario
FidoNet:  SYSOP, 1:221/171            | N2M 5E6 CANADA
Data:     (519) 742-8939              | (519) 741-9553
MC Hammer, n. Device used to ensure firm seating of MicroChannel boards
Try our new Bud 'C' compiler... it specializes in 'case' statements!

john@jwt.UUCP (John Temples) (11/26/90)

In article <5073.274CAD27@zswamp.fidonet.org> root@zswamp.fidonet.org (Geoffrey Welsh) writes:
>*IF* the software is configured to do it, installing a 16550 
>*can* reduce CPU overhead slightly.
>   However, you won't feel the difference.

Depending on the environment, I would say the reduction is more than
"slight."  At one time, I had both a 16450 and a 16550 on my dumb
Digiboard.  I was switching my 38.4 kbps terminal between the two
ports to see what difference it made.  CPU utilization (as measured
by u386mon) went from over 40% on the 16450 to under 10% on the
16550.  This was measured on a 386/33 running UNIX, with serial
drivers that took advantage of the 16550.  I imagine the difference
would be even more noticeable on a slower machine.

>   Here's a quick DOS Turbo Pascal program I hacked together to enable the 
>FIFOs on a 16550 and set the trigger level to 1 byte

It should probably be mentioned that enabling FIFO mode can make some
software quit working.  I've seen the extra bits that are set in the
IIR when FIFOs are enabled mess up some interrupt handlers that
weren't expecting them.
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)

barry@dgbt.doc.ca (Barry McLarnon DGBT/DIP) (11/27/90)

From article <1990Nov21.145421.23315@elroy.jpl.nasa.gov>, by cyamamot@kilroy.jpl.nasa.gov (Cliff Yamamoto):
> Greetings!
> 
> I've been running my serial line at 38.4Kbaud on my 386 clone for a few
> weeks now without any problems (not running Windows or Deskview).  However,
> I've heard that one can change the UART to offload some work on the CPU.
> 
> Can anyone tell me if the 8250, the 16450 and the 16550A are pin-for-pin
> interchangable?  I'm not sure if I have the 8250 or the 16450, but I'd like
> to eventually plug in a 16550A.  Also do all three share the same port and
> programming characteristics?  Are 16550A readily available?
> 

16550A's are somewhat hard to come by at the moment, but TI has recently
announced the TL16C550A, so that should help improve the supply.  The
following is a summary I put together some months ago, that seems relevant
to this discussion:


                   INS8250 UART Family Comparison


NMOS Parts:

INS8250
INS8250-B

The INS8250 is the original version of the series.  The "B" version is
identical except for slower CPU bus timings (but fast enough for 4.77 MHz
8088 systems).  There is a long list of gotchas and software workarounds for
these chips.



"XMOS" Parts:

INS8250A

This is the improved version of the 8250.  It features improved bus timing
constraints, and design changes have eliminated nearly all of the gotchas
associated with the NMOS parts.  A major difference from the older parts is
that interrupts are now level-sensitive rather than edge-triggered.
Unfortunately, this means that interrupt-driven drivers written for the older
parts will probably break if you replace one with a newer "A" part.  The
symptom is that when multiple interrupts are pending, only the first one gets
serviced.  The necessary fix can be done in either software or hardware.


NS16450

This is essentially a higher-speed 8250A, developed for use in IBM AT-class
systems.  All of the comments in the preceding section apply.  There is a
potential problem in both this chip and the 8250A which can occur in full
duplex operation, involving loss of the THRE interrupt indication.  Several
workarounds are available to avoid this situation.


NS16550
NS16550A

The 16550 powers up in a mode completely compatible with the 16450.  It has a
number of enhancements over the 16450, including faster bus timings, on-board
FIFOs, DMA interface, and higher maximum baud rates.  However, the original
NS16550 was brain-damaged, preventing use of the FIFOs.  It should be avoided
in favor of the fully-functional NS16550A part.  It is possible for software
to distinguish between the two parts.



CMOS Parts:

INS82C50A
NS16C450

These are CMOS versions of the 8250A and 16450, and have no significant
compatibility problems with the latter.  They draw about 1/10 of the maximum
operating current of the XMOS parts.



Reference:  National Semiconductor Application Note 493, "A Comparison of the
            INS8250, NS16450 and NS16550A Series of UARTS"  (included in the
            "Microcommunication Elements" Databook).

[Note: there are now several sources of CMOS 16550A parts, including TI,
as mentioned above, and VLSI Technology]

Barry

-- 
| Barry McLarnon     Communications Research Center, Ottawa, ON, Canada |
| Internet: barry@dgbt.doc.ca           				|
| Packet BBS: VE3JF@VE3JF        AMPRnet: barry@bbs.ve3jf [44.135.96.6] |

root@zswamp.fidonet.org (Geoffrey Welsh) (11/28/90)

John Temples (john@jwt.UUCP ) wrote:

 >(Geoffrey Welsh) writes:
>*IF* the software is configured to do it, installing a 16550 
>*can* reduce CPU overhead slightly.
>   However, you won't feel the difference.

 >Depending on the environment, I would say the reduction is more than
 >"slight."  At one time, I had both a 16450 and a 16550 on my dumb
 >Digiboard.  I was switching my 38.4 kbps terminal between the two
 >ports to see what difference it made.  CPU utilization (as measured
 >by u386mon) went from over 40% on the 16450 to under 10% on the
 >16550.  This was measured on a 386/33 running UNIX, with serial
 >drivers that took advantage of the 16550.  I imagine the difference
 >would be even more noticeable on a slower machine.

   The difference is in the overhead of firing up the driver evrey time a 
character appears; if the incoming data stream is fairly heavy, a 16550 can cut 
down on the number of times you've got to do that context switch. I am 
beginning to gain an appreciation for how much overhead 386 Unix 
implementations have in this situation.

>   Here's a quick DOS Turbo Pascal program I hacked together to enable the 
>FIFOs on a 16550 and set the trigger level to 1 byte

 >It should probably be mentioned that enabling FIFO mode can make some
 >software quit working.  I've seen the extra bits that are set in the
 >IIR when FIFOs are enabled mess up some interrupt handlers that
 >weren't expecting them.

   It should also be noted that people who experience overhead decreases after 
installing 16550s but NOT enabling their FIFOs should get their heads 
examined. A 16550 without FIFOs is a 16450 (one interrupt per byte).
 

--  
UUCP:     watmath!xenitec!zswamp!root | 602-66 Mooregate Crescent
Internet: root@zswamp.fidonet.org     | Kitchener, Ontario
FidoNet:  SYSOP, 1:221/171            | N2M 5E6 CANADA
Data:     (519) 742-8939              | (519) 741-9553
MC Hammer, n. Device used to ensure firm seating of MicroChannel boards
Try our new Bud 'C' compiler... it specializes in 'case' statements!