Intel Corportation Personal Computer Enhancements Division May 5, 1992 SatisFaxtion 200 & 400 Smart UARTs Overview The purpose of this paper is to explain the performance and reliability improvements obtained in multitasking environments like Windows using the serial port facades inside the SatisFaxtion 200 & 400 rather than an external modem connected to a PC serial port, or an internal modem that has a conventional UART configured as a PC serial port. What is data overrun anyway? Before getting too deep into how the Smart UART works, let's review some of the problems encountered using a high speed modem on a PC serial port. Many of today's high speed modems implement error control protocols such as V.42 and MNP that transparently remove all data errors caused by impairments on the telephone line. The PC serial port it is connected to only sees the corrected error-free data. A communication application (e.g., PROCOMM, etc.) typically uses a routine called by serial port hardware interrupts to collect received data in a buffer for when it gets busy doing other things which take a long time -- for example writing received data to disk. As this buffer gets close to filling, flow control is used to tell the modem to stop sending data to the PC serial port. Flow control prevents the PC communication application character buffer from spilling over and losing good data because it is known in advance that the buffer is getting full. The local modem being held with flow control stalls the remote modem off by sending special V.42 or MNP messages that tell it to wait for a while. But now we are using 386 PCs with virtualized, preemptive multitasking environments like Windows that can distract the PC's processor for extended periods with no prior warning to the communication application. If the modem is not being held off with flow control and the PC's processor gets distracted for more than 1 character time (or up to 16 characters for a 16550A FIFO UART), data gets lost at the PC's serial port UART. Although flow control does a good job of preventing the communication application's buffer from overflowing and losing data, it cannot provide the same service for the UART's tiny buffer. If characters are lost like this during a file transfer (Zmodem, etc.), that damaged block must be sent again as if bad data was coming out of a modem that had no error control. If it happens while scrolling your Email, the lost characters will be missing from the text your are reading (e.g., $1000 may appear as $100). Confused? Consider this silly analogy. Let's say that you have a 10 gallon bucket of water that you want to get filled to wash the car, but some creep stole your garden hose, and the faucet is located right over an extremely fragile plant with shallow roots. Cleverly, you run into the house and get 2 coffee cups. As one cup is filling from the faucet, you are emptying the other into the bucket that is a foot or two away. All you have to do to prevent spilling water is to get that freshly emptied cup underneath the filling cup before it spills over -- no sweat! At about the 2 gallon mark, a bee lands on your nose, and you're suddenly not so concerned about how quickly you get that empty cup back under the faucet. Eventually, the bee decides you're a pretty raunchy smelling flower, and buzzes off. You then look over to just in time to see your shallow rooted plant floating down the gutter drain!! So then, think of the receiving modem as the faucet, the PC's UART as the two cups, and you are the PC's processor -- get it? What the Smart UART does for you Both the SatisFaxtion 200 & 400 fax modems have a large gate array device which in addition to other functions, provides special circuitry that appears to the PC processor as a standard 16450 compatible serial port. In reality, it's just a facade that looks just like a serial port. Instead of shifting the character bits serially in from and out to a modem on the far end of an RS-232 cable, the characters stay intact as bytes. These characters are transferred directly between the PC processor and the SatisFaxtion 200 & 400 80C186-16 on-board processor through the silicon. The special circuitry inside the device gives the 80C186-16 complete visibility and control of the 16450 facade internal workings. The 80C186-16 knows what the PC processor is doing on the other side of this facade, and more importantly, has direct control over what the PC processor sees. On SatisFaxtion 200 & 400, since the on-board 80C186-16 knows whether or not the PC processor has taken the last character that it deposited into the 16450 interface, it will NEVER try to put another character in until the previous one is read -- no data is spilled. Think of it as a really smart faucet that shuts off the water if you don't replace the cup in time. This is true no matter how fast the data is being moved or how busy the PC processor is. The on-board 80C186-16 will wait indefinitely until the PC processor has taken the last character before trying to give it a new one. This protection against data loss enables you to set your communication application baud rate (DTE rate) as high as you like with no fear of losing data. UART Rate simulation The serial port UARTs found on PCs (8250, 16450, etc.) transfer characters to/from the PC's processor at a rate proportional to the baud rate set by the communication application software. For example, with a setting of 9600 bits per second, a character is exchanged between the PC processor and the UART at the rate of (10 bits/char) / (9600 bits/sec) = .00104 sec/char. Unlike a real UART, the SatisFaxtion 200 & 400 could choose to ignore whatever baud rate the user had selected, transferring data between the 80C186-16 the PC's processor at the equivalent of almost 300K bits/sec. However, by default it intentionally runs slower than that for the following reasons: Compatibility During the development of the SatisFaxtion 200, At least one application (Prodigy) expects data transfers with the UART to occur at a certain rate, and develops timing problems if the actual transfer rate is significantly different from the expected rate. Multitasking When running a file transfer in the background under Windows on a relatively slow machine (e.g., 16 MHz SX), an unbridled character interrupt rate may tax the user's machine so heavily that it completely consumes all of that machine's processor, essentially shutting down all other windows for brief periods. This is particularly true of DOS communication applications running in a window. The user may choose to select a lower rate such that they can be working on something else in another window without periods of time that make the application seem sluggish or in a hung state. Human factors Error correcting protocols like V.42 and MNP free up data to the host PC in blocks rather than one character at a time. With SatisFaxtion 200 & 400 running open throttle, text flashes out to the screen in chunks rather than flowing out in streams like the lower settings on real UARTs. This can be a real annoyance in terms of visual stress, and can also make it really hard to pause the screen where you want. The actual rate that is simulated by the SatisFaxtion 400 is configurable using the AT"B=n command, where the decimal value n causes the following: n=0 (default) The SatisFaxtion 400 runs the Smart UART 1.05 times faster than a real UART for a given setting. n=1 The SatisFaxtion 400 runs the Smart UART 2.1 times faster than a real UART for a given setting. n=2 The SatisFaxtion 400 runs the Smart UART 4.2 times faster than a real UART for a given setting. n=3 (best) The SatisFaxtion 400 runs the Smart UART at full 80C186-16 processor bandwidth, and also minimizes the burden per character for the 80C186-16. This is nearly the equivalent of a 300K bit/sec UART. Also note that if the PC communications software sets the baud rate at 115,200 bits/sec, the Smart UART also run at full processor bandwidth, ignoring any AT"B setting. The default speed configuration runs at about the same speed as an actual UART to provide the smoothest and most compatible environment which will work well for all PC's. The other settings are used to obtain higher performance on faster PCs which are not running timing sensitive communication applications. The AT"B=3 setting provides the best performance not only because of the high transfer rate involved, but also removes overhead to the 80C186-16 caused by internal rate simulation routines. Note that the SatisFaxtion 200 is fixed at the 4:1 setting with no AT"B command provision, since there are fewer compatibility issues with a 2400 bit/sec modem. What are some uses of the AT"B command settings? Modems with V.42bis data compression can utilize a PC serial port rate at least 4 times that of the raw modem speed to prevent the uncompressed data from becoming bottlenecked at the PC's serial port. Thus to run a V.32bis (14,400 bits/sec) modem such as the SatisFaxtion 400, a serial port rate of at least 57,600 bits/sec is desirable. At times, streams of data are encountered which are highly compressible and would require a serial port rate much faster than 4 times the modulation rate to prevent bottlenecks. With an AT"B=3 setting, the SatisFaxtion 400 can outdistance most regular modems when the PC communication software doesn't support faster bit rates. An example of this is Windows 3.0, where the serial port drivers do not allow UART settings above 19.2K bits/sec. Microsoft chose this limit because operation above 19.2K even on the fastest machine of that era was believed to be a risky venture with a 16450. The new Windows version 3.1 comm drivers allow operation at up to 57.6 K bits/sec for Windows comm apps, and have also added 16550A support to lessen overrun problems. Unfortunately, Windows comm apps developed prior to Windows version 3.1 don't know how to ask Windows for the higher rates, so users would ordinarily have to wait for a Win3.1 update to their comm app. By using AT"B settings 1-3, the customer does not have to wait for an update to obtain outstanding performance with a V.32bis + V.42bis connection. Before leaving the topic of Windows, there are some nasty problems that need to be discussed pertaining to Windows 3.0 and Windows 3.1 communications drivers running in enhanced mode on slower machines. These problems even affect operation with the SatisFaxtion 400, and have nothing to do with loss of characters or data overrun. At faster character rates, the 32 bit protected mode (RING0) drivers inside the Windows WIN386.EXE kernel become unstable and crash. The result is a GENERAL PROTECTION FAULT which sometimes hangs the machine, but most often causes the PC to cold-boot as if the power switch had been cycled. Hopefully by working with Microsoft we'll be able to get them to address this in their next driver release, but until then AT"B=0 or AT"B=1 are the recommended settings for operation under Windows enhanced mode. Note that standard mode operation of Windows does not exhibit this problem. UARTs with FIFOs (16550A, etc.) So you may also ask, what do the FIFOs in a 16550A do for you? The 16550A receiver FIFO is a buffer which can hold up to 16 characters before losing any data. The 16550A has a programmable receiver trigger which can be configured to request service as soon as a single character arrives, allowing the host PC's processor to be distracted for up to 16 more character times without overrunning the FIFO and losing data. This can work very well for systems that occasionally have very long latency problems, but are otherwise not heavily affected by the overhead caused by having to service the UART once per each character. The receiver trigger has 3 other settings which configure the 16550A not to request service from the PC processor until it has collected up to 4, 8 or 14 characters, resulting in much less overhead per request (and less latency protection). This reduction in overhead can be used either to give more of the PC processor back to other applications that are running, or can also be used to handle a higher data rate. Note that if more than 4 character times have elapsed since the last character arrival, the 16550A will generate a request to prevent data from being trapped in a partially full FIFO. Getting back to our analogy, it's the same as having bigger cups. Since the cups are larger, you are not constantly busy swapping cups for a given flow rate. You can use this extra time between cup swaps to chat with your neighbor, or if you are ambitious you could open the faucet more to get the bucket filled faster. Just make sure you don't get distracted too long as the water level approaches your chosen full mark. Ideally, the 16550A receiver trigger should be set to the largest number of characters that won't cause any characters to be lost at that baud rate because of PC processor latency. On slower SX machines that take longer to task switch, a low trigger point may be required. The lower trigger point causes more frequent requests (overhead) of the PC processor as well, so a lower DTE rate setting may be the only alternative if the PC processor can't keep up with the flow rate. Interestingly enough, in Windows 3.1 Microsoft chose to set the 16550A receiver trigger at the highest possible setting of 14 characters, favoring low overhead for PCs fast enough to always respond to requests within 3 character times. Although this provides 3 character times of latency protection whereas before in 16450 mode there was only one, slower 80386SX equipped may lose characters at a rate where a receiver trigger setting of 8 may have provided adequate latency protection and efficiency to operate error free. You may be wondering which is better for running under Windows -- a 16550A that reduces burden, or the SatisFaxtion 200 & 400 Smart UART interface? The answer is really both! At a given baud rate, the 16550A when set to a 14 character receiver trigger will generate less overhead for the PC Processor. On the other hand, no matter what nasty transient things you may do in Windows that affect latency, the Smart UART is never going to drop a character on you. Glossary: COM Port A logical device name used with DOS that references a serial port in the IBM compatible PC. COM device names (COM1, COM2, etc.) are normally assigned in sequence by the order in which they are discovered by the PC's ROM BIOS when the machine is booted. These names are often incorrectly used to indicate the physical IO address at which a serial port if configured. See also Serial Port 8250 16450 These are UART devices developed by National Semiconductor Inc., which are commonly used in IBM PC compatible computers. They each have the ability to buffer only one character for both receive and transmit. See also definition of UART below. 16550A This is a UART device developed by National Semiconductor Inc. that contains two 16 byte FIFOs, one for receive and one for transmit. The receive FIFO reduces the likelihood of losing received characters caused the hosting microprocessor's inability to remove the prior character in time, and also reduces the hosting microprocessor's overhead by collecting more than one character before interrupting it. The transmit FIFO reduces the overhead caused by interrupting the processor each time a character is sent. It was originally developed for the IBM PS/2 line of personal computers, but has recently been growing rapidly into ISA and EISA bus applications as well since the appearance of high speed modems and laptop serial file transfer packages. FIFO First In, First Out. This is a memory or storage area that preserves the order of data, queuing the data up until the recipient is able to remove it. Latency The delay from when a piece of data or service is requested until the time it is actually delivered or removed. Serial Port The combination of a UART and an external connector (usually DB-9 or DB-25) which is used to operate devices such as modems, serial printers, and mice. UART Universal Asynchronous Receiver/Transmitter. The purpose of this device is to break down entire characters into a single bit serialized stream that is sampled by the remote end at known intervals and re-assembled into characters. By using only a single wire in each direction to carry the information, substantial savings are realized in cabling and connector costs.