Section 22.2. Serial Ports

   

22.2 Serial Ports

PC serial ports, also known as communications ports, comm ports, asynchronous ports, or async ports, connect slow bit-oriented peripherals like modems, mice, printers, and plotters to the fast, byte-oriented system bus. Serial ports may reside on motherboards or expansion cards, or be embedded on devices like internal modems. PC serial ports haven't changed much over the years, although they're faster now and have larger buffers.

Serial ports were formerly used to connect almost anything to a PC modems, mice, printers, plotters, etc. Nowadays, serial ports are used mostly to connect modems and other peripherals (like the Palm cradle) that do not require high- speed communications. Although serial ports are obsolescent and will eventually be replaced by USB ports, nearly any motherboard or PC you buy today will have one or two serial ports, although one or both may exist only as a group of header pins on the motherboard, rather than as visible ports on the rear panel connector. For now at least, the serial port is sometimes the best (or only) way to get the job done. The following sections describe what you need to know to use serial ports effectively.

The so-called "legacy-reduced" motherboards and systems that began coming to market in late 1999 may or may not provide serial ports. "Legacy-free" systems and motherboards began shipping in volume in mid-2000, and do not provide serial ports (or many other formerly standard connections, such as parallel ports, PS/2 mouse and keyboard ports, a floppy diskette drive interface, etc.). These systems depend entirely on USB for external connectivity. If you need to connect a legacy serial device (e.g., a Palm cradle) to such a system, there are two options. First, you can install a PCI serial card, which typically supplies two high-speed serial ports and perhaps a parallel port. Otherwise, you can buy a USB-to-serial converter, various models of which are available from Belkin and others.

22.2.1 Serial Port Standards

Because they transfer only one bit at a time, using serial communications interfaces to establish a unidirectional connection between two devices in theory requires only one data circuit. This circuit comprises one data (or signal) wire and a second wire (called the ground, return, or common) that completes the electrical circuit. In practice, most PC serial communications devices use additional wires to enable bidirectional communication, to provide control circuits between the devices, and so on.

Serial port interface and signaling specifications are defined by the Electronic Industries Association (EIA) standard Interface Between Data Terminal Equipment and Data Communication Equipment Employing Serial Binary Data Interchange, Revision D. This standard is properly abbreviated EIA-232D, but is usually called RS-232C, for the earlier and nearly identical revision C. The ITU (formerly CCITT) defines essentially identical standards as V.24 (interface) and V.28 (signaling).

22.2.1.1 DB25 Pin Definitions

EIA-232D defines pin assignments, but does not specify physical connectors. In the PC environment at least, a well-established defacto standard does exist for 25-pin serial connections. By convention, DTE devices (e.g., PC serial ports) use a 25-pin male D-sub plug connector, designated DB25M. DCE devices (e.g., modems) use a 25-hole DB25F female socket connector. There are exceptions. For example, some serial printers are DTE devices but use a DB25F connector. Figure 22-1 shows a DB25 connector.

Figure 22-1. A DB25 connector
figs/pcn2_2201.gif

Table 22-1 lists DB25 pin assignments. The column headings are self-explanatory, except the following:

I/O

Signal direction, relative to the DTE. For example, a DCE (modem) asserts voltage on pin 5 (CTS) to notify the DTE (serial port) that it is ready to accept data from the serial port. We list this signal direction (from the DCE to the DTE) as In. Pins 1 and 7 are ground pins, and have no signal direction. Pin 11 is unassigned, and so has no signal direction.

CCITT, EIA, and RS

The circuit numbers/names used by CCITT, EIA, and RS standards documents, respectively. Circuits with a hyphen (-) are defined by the standard in question but not assigned a name. Circuits with a blank box are neither defined nor named.

Table 22-1. DB25 serial port pin assignments

Pin

I/O

CCITT

EIA

RS

Common name(s)

Abbreviations

1

-

101

-

AA

Chassis Ground

GND

2

Out

103

BA

BA

Transmit Data

TD, TxD, SOUT

3

In

104

BB

BB

Receive Data

RD, RxD, SIN

4

Out

105

CA

CA

Request To Send

RTS

5

In

106

CB

CB

Clear To Send

CTS

6

In

107

CC

CC

Data Set Ready

DSR

7

-

102

AB

AB

Signal Ground

SG

8

In

109

CF

CF

Data Carrier Detect, Carrier Detect, Receive Line Signal Detect

DCD, CD, RLSD

9

In

 

-

-

Test Voltage (+12V)

 

10

In

 

-

-

Test Voltage (-12V)

 

11

       

(unassigned)

 

12

In

122

SCF/CI

SCF

Secondary Data Carrier Detect

SDCD

13

In

121

SCB

SCB

Secondary Clear To Send

SCTS

14

Out

118

SBA

SBA

Secondary Transmit Data

STD

15

In

114

DB

DB

Sync TX Timing DCE (Transmit Clock)

TC

16

In

119

SBB

SBB

Secondary Receive Data

SRD

17

In

115

DD

 

Sync RX Timing DCE (Receive Clock)

RC

18

In

 

LL

 

Local Loopback

LL

19

Out

120

SCA

SCA

Secondary Request To Send

SRTS

20

Out

108.2

CD

CD

Data Terminal Ready

DTR

21

In

110

CG

CG

Signal Quality

SQ

22

In

125

CE

CE

Ring Indicator

RI

23

In/Out

111/112

CH/CI

CH/CI

Data Signal Rate / Speed Indicator

DRS / SI

24

Out

113

DA

DA

Sync TX Timing DTE (Transmit Clock)

XTC

25

In

 

TM

 

Test Mode

 

EIA-232D maps circuits, all of which are named from the point of view of the DTE device, to pin numbers. Placing a voltage signal on a circuit is called asserting or raising that circuit. For example, placing voltage on pin 20 asserts (or raises) DTR. Although you probably don't need to understand these signals in detail, knowing something about their purposes will help you choose the right cable and troubleshoot connection problems. The signals asserted on the EIA-232D pins and pin pairs commonly used in PC serial communications have the following purposes:

Pin 1 [Protective Ground (GND)] and Pin 7 [Signal Ground (SG)]

Pin 1, if present, grounds one end of the cable shield to the equipment chassis to reduce interference. Pin 7 is the common ground reference for all signals on other pins. Pin 7 must be connected at both ends for communication to occur. It is a relatively common (although poor) practice for cables to connect the grounds together, forming a single circuit.

Pin 2 [Transmitted Data (TD)] and Pin 3 [Received Data (RD)]

These pins are used to communicate data. A DTE device transmits data on pin 2 and receives on pin 3. A DCE device transmits on pin 3 and receives on pin 2. Pin 7 is the common return and ground reference for both of these circuits.

Pin 4 [Request to Send (RTS)] and Pin 5 [Clear to Send (CTS)]

The DTE asserts RTS when it wants to send data to the DCE, and the DCE asserts CTS when it is ready to receive data. The DTE may not transmit data until the DCE asserts CTS. CTS may be linked to RTS, allowing the DTE to use RTS to assert CD, if the DCE is so configured.

Pin 6 [Data Set Ready (DSR)] and Pin 20 [Data Terminal Ready (DTR)]

The DCE device asserts DSR when it is powered on and not in test mode. The DTE asserts DTR when it is powered on. In modem applications, DTR may be used to emulate an off-hook condition. If the modem is in auto-answer mode, RI may be linked to DTR, causing DTR to be asserted and the modem to answer when an inbound ring is sensed.

Pin 8 [Received Line Signal Detector (DCD or CD)]

Although the proper name of this circuit is Received Line Signal Detector (RLSD), nearly everyone calls it Data Carrier Detect (DCD) or simply Carrier Detect (CD). The DCE asserts CD to tell the DTE that a carrier is present at the DCE. In modem applications, this means that the DCE is receiving a telephone line signal that meets its criteria for presence of a carrier. Many DTE devices will not transmit or receive data unless the DCE is asserting CD. Accordingly, in non-modem (direct connect) applications, pin 8 (CD) is normally tied to pin 20 (DTR). Because the DTE normally asserts DTR as soon as it is turned on, this "spoofs" the DTE into believing that DCD has been asserted.

Pin 22 [Ring Indicator (RI)]

The DCE asserts RI to notify the DTE that the phone is ringing. When configured in auto-answer mode, the modem (DCE) asserts RI in step with the ring cadence. That is, when ring voltage is present, the DCE asserts RI; between rings, the DCE drops RI. The DTE instructs the DCE to answer the call by asserting DTR on pin 20.

PCs commonly use nine of the preceding ten pins and signals (excluding pin 1, GND). Pins 12 through 17, 19, 21, 23, and 24 are not used for standard PC serial connections, but may be used in nonstandard ways by proprietary serial devices. Most commercial DB25 serial cables are labeled as "9-wire," "10-wire," or "25-wire." The first connects only the most commonly used pins. The second also connects GND. The third connects all 25 pins.

22.2.1.2 DB9 Pin Definitions

When IBM introduced the PC/AT in 1984, it used a nonstandard DB9M 9-pin serial connector that included only the commonly used pins. Because this connector is physically smaller, it allowed putting both a serial port and a DB25F parallel port on the same expansion card bracket. The market presence of IBM and the passage of years have combined to make this DB9M serial connector a defacto standard. Like the DB25, DB9 connectors are available in male and female versions, designated DB9M and DB9F respectively. By convention, DTE devices use the DB9M. Few DCE devices use DB9 connectors. However, those that do usually use a DB9F. Figure 22-2 shows a DB9 connector.

Figure 22-2. A DB9 connector
figs/pcn2_2202.gif

Although its pinouts don't map to either DTE or DCE, the DB9M serial connector is considered an "honorary" DTE device, with DTE-to-DCE interfacing accommodated by the cable. The DB9 connector includes the nine important signals, but the pinouts differ from DB25, as Table 22-2 shows.

Table 22-2. DB9 serial port pin assignments

Pin

I/O

CCITT

EIA

RS

Common name(s)

Abbreviations

1

In

109

CF

CF

Data Carrier Detect, Carrier Detect, Receive Line Signal Detect

DCD, CD, RLSD

2

In

104

BB

BB

Receive Data

RD, RxD, SIN

3

Out

103

BA

BA

Transmit Data

TD, TxD, SOUT

4

Out

108.2

CD

CD

Data Terminal Ready

DTR

5

-

102

AB

AB

Signal Ground

SG

6

In

107

CC

CC

Data Set Ready

DSR

7

Out

105

CA

CA

Request To Send

RTS

8

In

106

CB

CB

Clear To Send

CTS

9

In

125

CE

CE

Ring Indicator

RI

22.2.2 Universal Asynchronous Receiver-Transmitter (UART)

The Universal Asynchronous Receiver-Transmitter (UART) is the heart of a serial port. When transmitting, the UART receives the outbound byte stream from the system bus, converts the bytes into a bit stream, and places the bits onto the serial interface. When receiving, the UART receives an inbound bit stream from the serial interface, buffers the inbound bits, assembles them into bytes, and places those bytes onto the system bus.

It's important to have the right UART, because that determines how fast serial connections can run, particularly with multitasking operating systems like Windows 9X and NT/2000/XP. For best performance, determine which UART you have, and replace it if necessary. You may have any of the following UARTs:

8250

The 8250 is an 8-bit UART used in original IBM PCs and compatibles, and occasionally encountered in newer PCs with secondhand serial cards installed. If you find an 8250, pull the card and throw it away.

16450

The 16450 is a 16-bit UART used in PC/ATs and compatibles. It is common on 16-bit serial cards for 80286, 80386, and early 486 systems, and on the motherboards of such systems. It runs 19.2 Kbps reliably, and may be usable at 38.4 Kbps. It lacks buffering, making it unsuitable for multitasking operating systems like Windows 9X and NT/2000/XP. The 16450 may exist as a discrete chip on the system board or an expansion card, or as a part of a VLSI chipset. If the 16450 is socketed, you can replace it directly with a $5 16550AFN chip. If the 16450 cannot be replaced easily, you can either disable it and install a modern serial card, or simply continue to use the 16450 to connect a mouse or other slow serial device.

16550-series

The 16550 is a 16-bit UART used in late-model 486 systems, in early through current Pentium and higher systems, and in expansion cards intended for those systems. The 16550 uses a 16-byte FIFO buffer to support multi-tasking operating systems, which cannot always give immediate attention to interrupts generated by the serial port. The 16550 was defective, and was replaced by the 16550A. The 16550A supports 115 Kbps throughput. The 16550A is the minimum acceptable UART for a modern system.

16650

The 16650 is a faster 16550-class UART that doubles buffer size to 32 bytes and adds support for various modern BIOS features, including power management. The 16650 can run at speeds of about 900 Kbps, making it better suited than a 16550 for use with ISDN adapters and similar high-speed devices. Dual-16650 serial cards are available from SIIG, Boca, and others for under $50. The 16650 is the optimum UART for a modern system.

16750

The 16750 is an improved 16550-class UART that further expands the FIFO buffer to 64 bytes for transmit and 56 bytes for receive. As yet, these UARTs are not common on PCs, and are used primarily on specialized, very high speed devices like T3 interface cards.

22.2.2.1 Determining UART Type

Under DOS and Windows 9X, you can determine the UART type with Microsoft Diagnostics (MSD.EXE), with a general-purpose diagnostic utility such as SiSoft Sandra, or with a dedicated port diagnostics program such as PortMaster. Either of the latter two utilities can be downloaded from any of numerous Internet sites.

Figure 22-3 shows SiSoft Sandra displaying information about COM1 on an AMD Duron system, built on a Microstar motherboard that uses a VIA KT133 chipset, and running Windows 98. Sandra reports that COM1 uses a National Semiconductor 16550AN UART, which is not precisely true. The COM1 UART is actually just one of the functions provided by the Super I/O portion of the Southbridge of the VIA chipset. The UART is emulated rather than physically present, but as far as Windows and connected serial devices are concerned, this system might just as well have a real physical 16550AN UART.

Figure 22-3. Using SiSoft Sandra Ports Information to view serial port configuration on a Windows 98 system
figs/pcn2_2203.gif

Utilities that run under Windows NT/2000/XP are limited in the amount and accuracy of the information they can provide, because Windows masks the underlying hardware from the utility. For example, Figure 22-4 shows the results of running SiSoft Sandra Ports Information on a system running Windows NT 4. The Windows NT Hardware Abstraction Layer (HAL) prevents user-mode applications (like Sandra) from accessing the underlying hardware, so Sandra can report only what NT sees fit to tell it, which is often little or nothing.

Figure 22-4. Using SiSoft Sandra Ports Information to view serial port configuration on a Windows NT 4 system
figs/pcn2_2204.gif

If your system boots Windows NT 4 or Windows 2000/XP, the only way to obtain detailed information about the hardware is to boot DOS and run a DOS-mode diagnostic utility. You can use either a comprehensive commercial diagnostics program like CheckIt for that purpose, or a dedicated small utility such as PortMaster.

If the device has not yet been installed in the computer (or if you're willing to pop the lid), you can sometimes determine the UART type by examining the chips on the device to locate a UART number. However, many devices use VLSI/ASIC components rather than discrete UART chips, making it difficult or impossible to identify the UART type visually. In these cases, if you don't have the documentation, the only convenient way to determine the UART type may be to install the board, boot DOS, and run a diagnostics program.

Some "enhanced" VLSI/ASIC-based 16450 serial ports with FIFO buffering added may falsely report themselves to the operating system and applications as 16550s, although PortMaster usually detects them properly. These UARTs are commonly found on early 486 motherboards and "high-speed" serial cards designed for 486 systems. These bumped-up 16450s may or may not function properly with any particular combination of operating system and application, and should be replaced with a serial port that uses a 16550AFN or higher UART.

22.2.2.2 Choosing UART Type

Which UART you need to use for maximum throughput depends on three factors:

DCE-to-DCE rate

DCE-to-DCE rate specifies the actual link speed between the two communications devices. For example, V.90 "56K" modems actually talk to each other at a maximum of 53 Kbps (rather than 56 Kbps, due to FCC regulations limiting signal amplitude on a phone line). ISDN devices communicate with each other at 64 Kbps when using one B channel, 128 Kbps when using two, and so forth.

Data compressibility

Data compressibility is the degree to which source data can be compressed by the communications device before being placed on the DCE-to-DCE link. Some data (e.g. text, web pages, and databases) contains a great deal of embedded slack space, and can be compressed as much as 4:1 by the communications hardware. Other data (e.g., images, executables, etc.) is much less compressible.

DTE-to-DCE rate

DTE-to-DCE rate specifies the actual link speed between the local serial port and the local communications device. Setting this speed faster than the DCE-to-DCE rate allows the serial port to provide compressible data to the communications device quickly enough that the DCE-to-DCE link never runs out of data to transfer. The compression algorithms used by most communications devices allow 4:1 compression in theory, although 1.5:1 or 2:1 is more common in practice. This means that the DTE-to-DCE data rate must be at least 1.5 or 2 times the DCE-to-DCE rate (and, ideally, four times) to make sure the DCE is never kept waiting for data.

After you determine the UART types used by your serial ports, use the following guidelines to decide if these ports are adequate for their intended purpose:

8250 and variants

Serial ports that use these UARTs are long obsolete, and are completely unsuitable for use in any modern system. 8250-class UARTs were used on original IBM PC and XT class systems, and 8250-class add-on cards were installed in some 486 and early Pentium class systems. Replace any serial port that reports an 8250-class UART. If the UART is embedded in the motherboard, disable the motherboard serial port(s) in BIOS setup and install an add-on serial card with 16550AFN or higher UARTs.

16450 or higher

These ports are usually adequate for mice and similar low-speed devices, even on slow and/or heavily loaded computers.

16550A or higher

These ports are usually adequate for modems that use V.32bis (14.4 Kbps), V.34 (28.8 Kbps), or V.34+ (33.6 Kbps). These ports are marginal for V.90 (56 Kbps) modems, and single-channel (56/64 Kbps) ISDN applications, because they allow for only about 2:1 compression. A 16550A is unacceptable for dual-channel ISDN, because it limits the DTE-to-DCE rate to 115.2 Kbps, which is actually lower than the 128 Kbps DCE-to-DCE rate. All other things being equal, 16550A ports are less likely to be a bottleneck on faster and lightly loaded computers. On midrange 486s and less, and on heavily loaded slow Pentiums, the 16550A may be a bottleneck, and should be replaced with a 16650.

16650 or 16750

These ports are necessary to guarantee full throughput potential for any application that requires a DTE-to-DCE rate higher than the 115.2 Kbps DTE limitation of the 16550A and slower UARTs. In other words, you really need a 16650 or better for anything above a 28.8 Kbps V.34 DCE-to-DCE link. In practice, you probably won't notice much difference with anything up to a 56K modem, but you may notice a big difference with ISDN.

22.2.3 Resources Required by Serial Ports

Each standard serial port requires an IRQ and an I/O port. The serial port generates an interrupt on its assigned IRQ to get the processor's attention when it has data to transfer. The I/O port is a range of addresses, named for the first address in the range, that defines a "scratchpad" area that the serial port uses to exchange data with the computer. For example, I/O Port 0x3F8 includes the address range 0x3F8 through 0x3FF.

Serial ports are named COM[xxx]:, where [xxx] may be a number from 1 through 256. Although the serial port name technically includes the trailing colon, the colon is usually dropped for convenience, and that is the practice we follow. IBM originally defined only COM1 and COM2 for the PC BIOS, although they later defined standard values for COM3 and COM4 as well. Table 22-3 lists the standard COM port assignments for ISA/PCI systems. (Systems that use the EISA or MCA bus use additional COM ports with different settings, but these systems are obsolete and immaterial.) The values for COM1 and COM2 are invariant due to long usage. The values for COM3 and COM4 are semi-standard, but may differ on some systems.

Table 22-3. Standard COM port assignments on ISA/PCI-based systems

Port name

Base address

I/O port range

IRQ

COM1

0x3F8

0x3F8 - 0x3FF

4

COM2

0x2F8

0x2F8 - 0x2FF

3

COM3

0x3E8

0x3E8 - 0x3EF

4

COM4

0x2E8

0x2E8 - 0x2EF

3

Note that ports 1 and 3 and ports 2 and 4 share an IRQ. Although EISA and MCA systems permit IRQs to be shared gracefully, ISA/PCI systems do not. This means that, in effect, you can use only two serial ports safely on a system that uses standard COM port assignments. You may be able to get away with such sharing say by putting a serial printer on COM3 and a mouse on COM1 but you must make sure never to use both devices that share one IRQ at the same time.

Windows 95 went a long way toward solving this problem by adding support for up to 128 COM ports. Windows NT 4.0 goes further still, supporting up to 256 COM ports and allowing you to define custom values for IRQ and base address for each installed COM port. Because Windows applications use COM ports by name and are not concerned with underlying settings, it is relatively straight-forward to support multiple COM ports in the Windows environment.

A final note: PCs assign a priority to each IRQ, and process interrupts on the higher priority IRQ first. The highest priority IRQ is 0, followed by 1, 2/9, 10 through 15, and then 3 through 8. Put high-priority devices like modems on a high-priority serial port (e.g., COM2/IRQ3) and low-priority devices like mice on a lower priority serial port (e.g., COM1/IRQ4). This is less important with recent UARTs than it used to be, but is still worth doing as a matter of good practice.

22.2.4 Enhanced Serial Ports

The proliferation of high-speed external serial devices, notably serial ISDN terminal adapters, made it obvious that something faster than the standard 16550 UART was needed. The standard serial ports on most PCs top out at 115 Kbps or (rarely) 230 Kbps. That's not fast enough to support the full throughput of a dual B-channel ISDN terminal adapter, which operates at 128 Kbps natively, and up to four times that fast when data compression is enabled.

To address that need, various manufacturers supply enhanced serial ports, which are add-on cards that include one or two serial ports. These use 16650 or 16750 UARTs, which are essentially 16550 UARTs with additional buffering added. Some cards also include an embedded processor, typically an 80186 or 80286, which offloads interrupt handling from the main processor.

These adapters are overkill for normal serial port applications, may provide some benefit for 56K dial-up modems, and often provide a noticeable performance increase for ISDN applications. If you buy such a card, make sure that it includes any necessary drivers for your operating system.

22.2.5 Multiport Serial Adapters

Each standard serial port occupies one IRQ, which limits how many standard serial ports can be installed. Most computers need one or two serial ports at most, so this is seldom a problem. But there are applications such as running a terminal server under Linux where it is desirable to have 8, 16, or more serial ports available. That's clearly impossible if each serial port requires one IRQ. The solution is a special board called a multiport serial adapter.

These adapters are available in ISA and PCI form, and are installed in the PC just like any other expansion card. They provide from 4 to 32 serial ports using only one IRQ. The serial port connectors reside in a separate external box that connects to the multiport serial adapter via multiple 8P8C ("RJ-45") connectors or a single proprietary octopus cable with many conductors.

Such adapters are available in two forms: "dumb" multiport serial adapters are little more than a collection of UARTs and connectors, use 8-bit transfers, generate an interrupt for each byte transferred, and depend on the host PC for processing power. "Smart" multiport serial adapters include a microprocessor (typically an 80286 or 386) that offloads serial interrupt processing tasks from the host PC. Smart adapters usually buffer 1KB of data or more between transfers, greatly reducing the interrupt burden on the host system. Nowadays, most multiport serial adapters are of the smart variety.

Dumb terminals have become rare in most applications LAN connected PC clients are much more common nowadays, even on Linux systems and so the need for multiport serial adapters is much less than formerly. If you do need one, for example for process control, automation tasks, or building a terminal server for a modem pool, make sure that drivers are available for your operating system.

       


    PC Hardware in a Nutshell
    PC Hardware in a Nutshell, 3rd Edition
    ISBN: 059600513X
    EAN: 2147483647
    Year: 2002
    Pages: 246

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net