UART Explained
The Universal Asynchronous Receiver/Transmitter is the device inside your computer
that turns the internal parallel data stream into serial for transmission down one cable. It
receives a character, generates an interrupt and stores it in a buffer till the next character
comes, assuming the CPU is able to take it before then.
The original design supplied with
the IBM PC was the 8250, shortly to replaced with the one for the AT, the 16450. The 8250 took
1000ns to reset after dealing with an interrupt, which wasn't a problem initially, as the PC
itself took twice as long to access it. However, when faster machines came along, their access
time was the same, and eventually less than the UART's reset time. The 16450 was able to reset
inside 200ns, so the problem went away for a while. It is capable of transmitting or receiving up
to around 9600 bits per second without framing errors, which occur when the amount of information
received does not match what is indicated between the first and last bits of a frame. When
transmitting at 9600 bps, you are interrupting the CPU around 1000 times a second, so with a
standard UART you will lose characters if the CPU can't take up the stored characters in time. At
19200 bps, the interrupt frequency is approx 1920 times a second; if you compress your data (say
with V.42), and get an effective speed of 115,200, the CPU must rescue a byte every .000087
seconds! To get higher performance, the 16550A was invented, which had a 16-byte buffer and was
therefore able to store more characters until its interrupt was able to be serviced. The 16650
has a 32-bit buffer.
The amount of characters stored before an interrupt is generated is
programmable, and is known as the trigger level. Windows starts at 14, which unfortunately gives
you only one better byte's leeway than the 8250! As the 16550 is pin-compatible with the 16450,
and is therefore a straight swap, some applications may not automatically recognize it.
Here
are the maximum speeds you can expect under different UARTs:
CPU 16650 16550A 8250/16450 386SX
38400 19200 386DX 57600 19200 486SX 115200 38400 486DX 46080 115200 38400
Unfortunately,
the UART isn't the whole story, being only one element in the chain of components inside and
outside your computer, including modems, software and overall speed of hardware. Multi-sector
disk I/O (set in your Advanced CMOS) will disable interrupts until any hard disk transfers are
complete, so you could lose characters. Smartdrive delayed writes also take priority. Interrupt
Latency is discussed under Performance.
This is an article from
Phil Croucher, author
of Communications and Networks. Phil
has a way of explaining in "plain" English. The information is well presented and is well
above A+ standard.
|