[comp.dcom.modems] UARTS and Buffers...

ST7021@SIUCVMB.BITNET (04/01/91)

Recently someone brushed on two different UARTs, the 16450 and the 16550.
Can someone give me an idea of what the difference between these two chips
is? It seemed that what brand you get makes a big difference.

MPt (an MS-DOS communications protocol) reports that my Practical Periphreals
PM2400 has a 16450 and that the serial port of my PS/2 model 80, hooked up to
a Hayes V-series 9600, has a 16550. The reason that I bring up MPt is because
the PS/2 tech ref manual says that my mod 80 has a 16450. Anyone have an idea
of what the truth is? I would tend to believe the tech ref, but if MPt has
successfully identified a 16450 I wouldn't think that it would then make a
mistake about the next one.

One last question - why doesn't the everyday serial port have a small buffer
on it? It would seem that putting even a small buffer on the serial port
would be a great relief to a CPU (espically one that is multi-tasking), as
opposed to having to tend to an interrupt everytime a new character comes in.
All at a cost of one or two dollars (or less?). Do modems with buffering
overcome this problem?

Thanks in advance for the help and answers!

Thomas Boehler

tnixon@hayes.uucp (04/02/91)

In article <9104010808.AA05643@ucbvax.Berkeley.EDU>,
ST7021@SIUCVMB.BITNET writes: 

> Recently someone brushed on two different UARTs, the 16450 and the 16550.
> Can someone give me an idea of what the difference between these two chips
> is? It seemed that what brand you get makes a big difference.

The primary difference is that the 16550 has a 16-byte FIFO buffer.  
This allows the main CPU to put off respond to interrupts with less 
risk of losing data, and also allows a reduction in interrupt 
processing overhead (because multiple bytes can be transferred for 
each interrupt).

> One last question - why doesn't the everyday serial port have a small buffer
> on it? It would seem that putting even a small buffer on the serial port
> would be a great relief to a CPU (espically one that is multi-tasking), as
> opposed to having to tend to an interrupt everytime a new character comes in.
> All at a cost of one or two dollars (or less?). Do modems with buffering
> overcome this problem?

Back when the 8250 was selected for the IBM PC serial port, most 
people were using 300bps modems, and 1200bps modems were just 
becoming available.  I suppose IBM simply didn't foresee the days of 
V.42bis, V.32bis, and 57600bps data transfers!  Modem technology has 
improved much faster than serial port technology.  The requirement 
for backward compatibility with existing comm software has held back 
advances in comm ports, although the Hayes ESP attempts to provide a 
transition by supporting both backward compatible modes _and_ 
enhanced modes (with 1K-byte FIFOs, automatic flow control, DMA 
transfers, etc.)

Having buffering in modems does NOT help this problem at all.  If 
you're using a 16450, all you have to do is receive TWO characters 
without the main CPU processing an interrupt and you have a receive 
data overrun.  There's almost no way for any flow control scheme to 
operate to prevent this from happening -- additional buffering in 
the UART (or on the card, operating independently of the main CPU),
combined with automatic flow control, is the only real solution.

-- 
Toby Nixon, Principal Engineer    | Voice   +1-404-840-9200  Telex 151243420
Hayes Microcomputer Products Inc. | Fax     +1-404-447-0178  CIS   70271,404
P.O. Box 105203                   | UUCP uunet!hayes!tnixon  AT&T    !tnixon
Atlanta, Georgia  30348  USA      | Internet       hayes!tnixon@uunet.uu.net

root@zswamp.fidonet.org (Geoffrey Welsh) (04/02/91)

 >From: ST7021@SIUCVMB.BITNET

 >Recently someone brushed on two different UARTs, the 16450 
 >and the 16550.
 >Can someone give me an idea of what the difference between 
 >these two chip is?

   The 16450 is essentially the same as an 8250, and they're plain UARTs.  
When a word is received, it is transferred into a holding register and an 
external signal is generated (usually an interrupt request).  If the CPU 
fails to read the receive data register before the next incoming word is 
completed, the data word is lost.  This can be caused by heavy 
multitasking loads, long DMA cycles (Perstor ARLL controllers) or switching a 
286 processor from protected into real mode on an ISA machine (DOS extended 
memory access or DOS compatibility box under OS/2).

   The 16550 has, in place of the single byte data registers, a 16 byte FIFO 
buffer.  This way, if the CPU can't react quickly to the interrupt request, 
the data is stored and recalled in order rather than lost.  The CPU may also 
write sixteen bytes for transmit in stead of one, and the interrupt request 
may be set to trigger on different buffer fill levels, reducing the interrupt 
overhard on the CPU.

   While not as effective as a smart serial board (like a DigiPort or Arnet 
SmartPort), the 16550 can solve data loss problems and reduce CPU loading 
without losing compatibility with drivers designed for the 8250 (this is 
especially important if you're running DOS standalone, under a multitasker 
(Concurrent DOS, DesqView, PC-MOS, Windows, etc.), or in a compatibility box 
such as VP/ix, DOSmerge, or RUNDOS (for QNX).

   Few drivers will detect and enable the 16550 (though more and more are 
appearing), but many drivers designed for the 8250 will work with a 16550 
after the FIFO buffers have been enabled externally.

 >The reason that I bring up MPt is because
 >the PS/2 tech ref manual says that my mod 80 has a 16450. 
 >Anyone have an idea of what the truth is?

   If a program reports that it has found a 16550, then it has found a 16550.  
I am not aware of any other UARTs that could easily be mistaken for a 16550 
unless the program was not written to National Semiconductor's specs.  If you 
like, I can ship you a copy of a little DOS program I wrote to detect the 
16550 and control its buffers.

   I had also heard that the NS16550A was the 'standard' UART on the PS/2.

 >One last question - why doesn't the everyday serial port 
 >have a small buffer on it?

   I guess that the UART in itself was such a big step that putting buffers on 
them didn't seem necessary right away.  Certainly the majority of micros with 
UARTs didn't need buffers, as modems above 1200 bps were rare a decade ago and 
it is only in the past four years or so that 9600, 19,200 and now even 38,400 
are common.

   Some home machines do RS-232 without any UARTs, let alone buffered ones.  
The Commodore 64 and 128 are examples.  BTW, the C128, with proper code, can 
do 9600 bps without a UART... any interested parties netmail me for details.

 >Do modems with buffering overcome this problem?

   Actually, I think they make it worse.  A 9600 bps modem with synchronous 
framing (such as MNP3 or LAP-M) can provide data at a speed higher than 960 
CPS, usually requiring the serial port to be operated at 19200 bps.  So, even 
though you're only going to get throughput around 1150 CPS on most compressed 
data, the hardware must be able to handle bursts of data at 1920 CPS... the 
average load over a long period might not be much higher than a 9600 bps 
connection, but it can, for those short periods, be an effective 19200 bps 
load.
 

--  
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
The mile is traversed not by a single leap, but by a procession of coherent 
steps; those who insist on making the trip in a single element will be
failing long after you and I have discovered new worlds. -- me

dwayne@stratsft.UUCP (Dwayne Bailey) (04/03/91)

In article <9104010808.AA05643@ucbvax.Berkeley.EDU> ST7021@SIUCVMB.BITNET writes:
>Recently someone brushed on two different UARTs, the 16450 and the 16550.
>Can someone give me an idea of what the difference between these two chips
>is? It seemed that what brand you get makes a big difference.

The 16540 and 16550 (as well as the 16550A) are all UART chips from National
Semiconductor.  They are designed to replace the 8250 used the the original
PC to gain a higher throughput that 9600 bps on AT class machines.

The primary difference between the chips lies in the use of a FIFO buffer.
The 16540 is unbuffered.  The 16550 and 16550A have two 16 byte buffers
(one for transmission, one for reception.)  This greatly reduces the overhead
to the CPU, as it doesn't get interrupted for every character.  Unfortunately
the 16550 has a bug in the receiver FIFO, and can sometimes give extra
characters that were never sent!  The 16550A fixes this problem.  Thus the
16550 should not be used if FIFO mode (that is from the NSC data book on the
16550A.)

Note that some software which detects the 16550 FIFO does not detect the
difference between the 2 chips (QModem 4.0 under DOS, for one.)  Thus, your
communication may contain sporatic errors.  If you have a 16550, replace it
with the 16550A if at all possible.

========================================================================
..!uunet!basfpac!stratsft!dwayne

Dwayne Bailey      +  Strategic Software is ME, so my opinions ARE those
Strategic Software +  of my company!
========================================================================

bob@uis-oc.UUCP (Robert J. Mathias Jr.) (04/03/91)

In article <9104010808.AA05643@ucbvax.Berkeley.EDU> ST7021@SIUCVMB.BITNET writes:
>Recently someone brushed on two different UARTs, the 16450 and the 16550.
>Can someone give me an idea of what the difference between these two chips
>is? It seemed that what brand you get makes a big difference.
>
The major difference between the 16450 and the 16550A is that the 16550A   
includes a small (16 bytes in each direction) buffer.  However this buffer
is only used if the software turns on the buffering feature.  For a more
complete discusion on PC serial communications, I would recommend reading
in the current Byte Magazine (April 1991), the article "High-Speed Safety"
by Ken Krechmer.

dscavo@ncratl.AtlantaGA.NCR.COM (David Scavo) (04/03/91)

In <9104010808.AA05643@ucbvax.Berkeley.EDU> ST7021@SIUCVMB.BITNET writes:

>One last question - why doesn't the everyday serial port have a small buffer
>on it? It would seem that putting even a small buffer on the serial port
>would be a great relief to a CPU (espically one that is multi-tasking), as
>opposed to having to tend to an interrupt everytime a new character comes in.

That is what the 16550 is. It is a 16540 with a small buffer (I can not
remember exactly how big it is). The buffer is especially helpful when
doing 9600+ bps in a multitasking environment (Desqview, Windows, etc).
IF a buffered UART is not used when multitasking, characters are dropped
and the download usually aborts. Hope this helps.
-- 
   --------------------------------------------------------------------------
   Internet: dscavo@ncratl.AtlantaGA.NCR.COM              NCR Corporation
   UCCP: ... !gatech!kong!ncratl!dscavo                   2651 Satellite Blvd
    "Bart, you say butt kisser like it is a bad thing"    Duluth, GA 30136