40 SERIAL (RS232) PORT TROUBLESHOOTING
CONT CO NTEN ENTS TS AT A GL GLAN ANCE CE Understanding Asynchronous Communication The data frame Signal levels Baud vs. bps
IrDA IrD A Port Issues Installing the IrDA driver(s) Removing Remov ing the IrDA driver driver(s) (s) IrDA tips
Troubleshooting the Serial Port Understanding the Serial Port Addresses and interrupts DTE vs. DCE
Serial-Port Signals TX and RX RTS and CTS DTR and DSR DCD RI
A
Serial-port conflicts Match the settings Frame it right Finding a port address with debug General symptoms
Further Study
lthough the parallel port is slowly gaining acceptance as a peripheral communication port, early PCs used the parallel parallel port almost exclusively exclusively for local printers. As more and more peripherals became available for the PC, alternative methods of communication were required that were ill-suited ill-suited for parallel connections connections at the time. The Electronics In1176
UNDERSTANDING ASYNCHRONOUS COMMUNICATION
1177
dustry Association (EIA) (EIA) developed a standard for serial communication. communication. Instead of sending eight bits at a time over a set of data lines, only two data lines were used: one to transmit data and one to receive data. data. The EIA denoted its serial serial standard as RS-232 as RS-232 (or simply the serial the serial port ). ). A serial port offers several distinct distinct advantages over early parallel ports. ports. First, the serial port was was designed to be bi-directional, right from from the start. This made serial the preferred method for interactive interactive devices, such as modems, mice, etc. etc. Second, the serial port used fewer physical signal lines lines than the parallel port. This made cabling less expensive and reduced potential potential connector problems. Where a printer cable is generally generally limited to two meters in length, a serial cable can easily exceed 60 meters. meters. This difference opened the way for basic local networking. networking. This chapter shows you the essential essential concepts of serial communication and port operation, then guides you through a series of trou bleshooting procedures.
Understanding Asynchronous Communication The serial port is not terribly difficult to grasp, but its operation is a bit more involved than that of a parallel port. To appreciate the operations and signals of a typical serial port, you should be familiar with a variety of concepts. concepts. When a parallel port strobes a printer, the printer “knows” that all eight eight bits of data are available and valid. However, a serial port must send or receive eight data data bits one at a time over a single data line. As you might imagine, this presents some serious challenges for the receiving device which must determine where the data stream starts starts and ends—hardly a simple task. It is certainly possible to send a synchronizing clock signal along with the data wire. The receiving device could easily use the clock to detect detect each data bit. This technique is known known as synchronous as synchronous serial communication.. It is reliable, but rarely used in PCs (other communication (other than the keyboard interface). Instead of using a discrete clock signal to accompany the data, it is possible to eliminate the clock by embedding synchronization information information along with the data bits. Thus, when a data stream reaches a receiving device, it can strip away the synchronization bits, leaving the original data. data. As a result, serial serial communication is not constrained by a clock. This is asynchronous communication —a popular and inexpensive serial technique. technique. The remainder of this chapter deals with asynchronous communication.
THE DATA DATA FRA ME Asynchronous communication requires that data bits be combined with synchronization bits before transmission. transmission. Synchronization bits provide three three important pieces of information to the receiving device: where the data starts, where the data ends, and if the data is correct. These bits, combined combined with the data byte, byte, form the data frame frame (Fig. 40-1). The first thing you should notice about serial data is that it is bi-polar—that is, there are both positive and negative voltages. Contrary to what you might guess, a + voltage represents represents a logical 0 (called a space a space), ), and a -voltage represents a logical 1 (called a mark ). ). The next next thing you should note is that the serial signal line is normally idle in the logic 0 (space) state.
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1178 1178
SE SERI RIAL AL (RS2 (RS232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
V Logic
0
(space)
1 V Logic
(mark)
1
0 S t a r t
1
0
0
0
1
Data bits
b i t
FIGURE FIG URE 4040-1 1
0
0
1 P a r i t y b i t
0
0 S t o p b i t (s)
A typical data frame.
The first element of all asynchronous data frames is a single start bit, which is always a logic 1 (mark). When the receiver detects a logic 1, it “knows” the data frame has started. The next five to eight bits are always the data bits. bits. The exact number of bits (usually (usually eight) can be set by the communication software, but must be the same at both the transmitting and receiving ends. After data, a single single error-checking bit (called (called a parity a parity bit ) can be included, if desired. Parity is calculated calculated at the sending sending device and sent with with the word. Parity is also calculated at the receiving device device and checked against the received parity bit. If the two match, the data data is assumed to be correct. correct. If the two do not match, match, an error is flagged. There are five classes of parity: parity: None No parity bit is added to the word. word. This is typical for muc much h of today’s serial communication. s Even If the number of 1s in the data word is odd, parity is set to 1 to make the number of 1s even. s Odd If the number of 1s in the data word is even, parity is set to 1 to make the number of 1s odd. s Mark Parity is always set to 1. s Space Parity is always set to 0. s
Many communication connections today abandon the use of parity in favor of the more reliable and sophisticated Cyclical Redundancy Check (CRC). (CRC) . A CRC has the same effect as a parity check, but instead of checking one byte at a time, an entire block of data is checked.
The last part of the data frame is the stop bit(s)—typically only one, but two can be used. Stop bits are always logic 0 (space). After the receiving device detects the stop bit(s), bit(s), the line remains idle in the space condition, awaiting awaiting the next subsequent start bit. Framing is
UNDERSTANDING ASYNCHRONOUS COMMUNICATION
1179
usually denoted as data/parity/stop. data/parity/stop. For example, the connection connection to a BBS typically uses 8/N/1 framing (8 data bits/no parity bit/1 stop bit). One of the most important aspects of serial com munication is that both the receiving and transmitting ends must be configured for the exact same data frame. If both ends are not configured identically, serial data will misinterpreted as meaningless garbage.
SIGNAL LEVELS Where the parallel port uses TTL-compatible logic signals in its communication, a serial port uses bi-polar signaling signaling (both positive and negative negative voltages). The advantage of bi-polar bi-polar signaling is that it supports supports very long cabling with minimum minimum noise. A logic 0 (space) condition is represented by a positive voltage between between +3 Vdc and +15 Vdc. A logic 1 (mark) condition is represented represented by a negative voltage between –3 Vdc Vdc and -15 Vdc. On the average, you can expect to see serial ports using ±5 Vdc or ±12 Vdc because those voltages are already produced by the PC power supply.
BAUD VS. BPS Another key concept of asynchronous communication is the idea of rate of rate.. Because data is traveling across a serial link versus time, the rate at which that data passes becomes an im portant variable. Although rate is not a literal part of the data frame, it is every bit as im portant. Simply stated, data rates are measured measured in Bits in Bits Per Second (bps) (bps).. This is a simple and intuitive measurement. measurement. If the serial port is delivering delivering 2400bits in one second, second, it is working at 2400bps. 2400bps. At that rate, rate, the average bit is (1/2400bps) (1/2400bps) = 417 s. When you are dealing with a serial port, you are dealing with bps. Traditionally, when the bits from a serial port are processed through a modem, a modem will modulate the the data through a series of phase, phase, frequency, or amplitude amplitude transitions. A transition is referred to as a baud (named baud (named for French mathematician mathematician J.M.E. Baudot). Baudot). Older modems that were designed to operate with signal rates of 2400bps or less could modulate the telephone line at the bit rate—thus, rate—thus, baud would be the same as bps. However, this is a faulty comparison. Because later modems were were restricted by the limited bandwidth bandwidth of a telephone line, modems modems had to encode more than one bit in every transition. As a result, the effective bps of a modern modem usually usually exceeds its baud rate by several times. times. For example, a modem that can encode 4bits in every transition can work at 2400baud, yet be sending the equivalent equivalent of 9600bps. See the difference? difference? As modems evolved to to encompass data compression standards, effective bps has been increased even more (yet the modem still only works at a relatively relatively low baud rate). rate). When you are dealing with modems, modems, you are usually talking about baud rates. You need to be aware of another catch. Because baud refers to any transition (Baudot never said a word about modems), it is technically valid to measure serial port speed in baud, although it can be terribly confusing. For example, today’s serial-port circuits can sustain data rates of 115,200bps . Now, because every bit from the serial port is treated as a “transition” by local devices, such as printers, it becomes just as correct to say 115,200baud. The thing to remember here is that most modems don’t operate over
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1180 1180
SE SERI RIAL AL (RS2 (RS232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
2400baud. The telephone line just cannot handle faster signal rates. So, if you see high baud rates quoted in books or specifications, it probably refers to the performance of the serial port, not the modem.
Understanding the Serial Port A serial port must be capable of several important operations. It must convert parallel data from the PC system bus into a sequence of serial bits, add the appropriate framing bits (which might be changed for different serial connections), then provide each if those bits to the data line at the proper rate. The serial port must also work in reverse, accepting serial data at a known rate, stripping off the framing bits, converting the serial data bits back into bus form, and checking blocks of data for for accuracy. The heart of the serial port is a single IC—the Universal Asynchronous Receiver/Transmitter (UART). (UART) . A simplified block diagram for a serial port is illustrated in Fig. 40-2. The UART connects directly to the PC bus architecture—either adde d to the motherboard or incorporated on an expansion board. A UART IC contains all of the internal circuitry necessary to process, transmit, and receive data between the serial line and the PC bus. Since the UART is programmable, its configuration (i.e., framing format and baud rate) can be set through DOS or Windows communication software. All data output, data input, and handshaking signals signa ls needed by the serial port are generated within the UART itself. It is ininteresting that the UART is powered by +5 Vdc only, just like any other ASIC in the system. This means that data and handshaking signals entering and leaving the UART are all TTLcompatible. Transmitted data is converted to bi-polar signals through a line-driver IC. BiPC bus Address decoder
Data bus buffer
Line drivers and receivers
Control logic
Tx buffer
Tx logic
Tx shift reg.
Line driver
Tx
Rx buffer
Rx logic
Rx shift reg.
Line receiver
Rx
UART registers
FIGURE FIGURE 40-2 40-2
IRQ RTS CTS DTR DSR DCD RI
Block diagram of a UART.
UNDERS UNDERSTAN TANDIN DING G THE SERIAL SERIAL PORT PORT
1181 1181
polar data that appears on the receive line is converted back to TTL levels through a linereceiver IC. All that remains is the port connector itself. The original serial-port design used a 25-pin male sub-miniature D-type connector, but newer ports have abandoned the extra handshaking signals to accommodate a 9-pin male sub-miniature D-type connector.
ADDRESSES AND INTERRUPTS The UART is controlled through a series of important registers that allow the serial-port characteristics to be programmed, channel transmitted, and received data, as required. Older BIOS versions supported only two serial (or COM) ports, but newer BIOS releases support four COM ports (designated COM1, COM1, COM2, COM3, and COM4). MicroChannel bus systems can support up to eight COM ports (COM1 through COM8). The typical base addresses for the COM ports are shown shown in Table 40-1. When a new COM port is installed installed in the system, it must be assigned assigned to a valid base address and interrupt (IRQ). (IRQ). During actual operation, communication communication software deals with each port register register individually. Table 40-2 lists the standard base address offsets for UART registers. With no offset, both transmit and receive registers are available. During system initialization, COM ports are checked in the following order: 03F8h, 02F8h, 03E8h, 02E8h, 03E0h, 02E0h, 0338h, and 0238h (MicroChannel systems use a different order), and COM designations are assigned, depending on what ports are actually found. The COM addresses might be exchanged, depending depending on your particular system. system. In virtually all cases, COM1 is available at 03F8h. The specific I/O addresses for each COM port are kept in the BIOS data area of RAM, starting at 0400h. As you might expect, only one COM port can be assigned to a base address. address. If more than one COM port is assigned assigned to the same base address, system problems will almost certainly occur. TABLE TABL E 40-1 TYPICAL TYPICAL SERI SERIAL AL PORT ADD ADDRESS RESSES ES AND IRQ ASSIGNMENTS
BUS ARCHITECTURE
PORT
ADDRESS
IRQ
All Systems
COM1
03F8h
IRQ4
All Systems
COM2
02F8h
IRQ3
ISA*
COM3
03E8h
IRQ4
ISA
COM4
02E8h
IRQ3
ISA
COM3
03E0h
IRQ4
ISA
COM4
02E0h
IRQ3
ISA
COM3
0338h
IRQ4
ISA
COM4
0238h
IRQ3
MCA
COM3
3220h
IRQ3
MCA
COM4
3228h
IRQ3
MCA
COM5
4220h
IRQ3
MCA
COM6
4228h
IRQ3
MCA
COM7
5220h
IRQ3
MCA
COM8
5228h
IRQ3
* Systems with DOS 3.3 and later
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1182 1182
SE SERI RIAL AL (RS2 (RS232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
T AB AB LE LE 4 00- 2 T YP YP IC IC AL AL UA UA RT RT REGISTER ADDRESS OFFSETS
REGISTER
OFFSET
Receive register
0 0h
Transmit register
00h
Interrupt enable register
0 1h
Interrupt ID register
02h
Data frame register
03 h
UART control register
04h
Serialization status register
0 5h
UART status register
06h
General-purpose re register
07h
The use of interrupts in conjunction conjunction with COM ports can easily be confusing. confusing. Unlike parallel ports, which can be polled by BIOS, a serial port demands the use of interrupts. Because early PCs allocated space for two COM ports, only two IRQ lines were reserved (IRQ4 for COM1 and IRQ3 for COM2). Unfortunately, when PC BIOS BIOS expanded its sup port for additional COM ports, no extra IRQ lines lines were available to assign. Thus, COM ports had to “share” interrupts. interrupts. For example, COM1 COM1 and COM3 must share IRQ4, while while COM2 and COM4 must share IRQ3. The problem is that no two devices can use the same IRQ at the same time—otherwise, time—otherwise, a system conflict will result. result. Ultimately, though, though, a typical PC can use four COM ports, only two of the four can be used at any one time (i.e., COM1 and COM2, COM3 and COM4, COM1 and COM4, or COM2 and COM3). Further, the assignment of COM COM port address and IRQ lines must match. match. Although COM3 and COM4 can be polled by BIOS, the speed and asynchronous nature of contemporary data transmission make polling very unreliable for serial ports. Always begin a service examination by checking the number of serial ports in your system. Serial ports are so simple simple and easy to add to various expansion cards that you might might exceed the maximum number of ports or allow two ports to conflict without even realizing it. Be sure to remove or disable any unused or conflicting conflicting COM ports by removing removing the offending port or disabling it through jumpers or DIP switches.
DTE VS. DCE As you work with serial ports and peripherals, you will often see the acronyms DTE and DCE used very frequently. DTE represents Data represents Data Terminal Equipment , which is typically the computer containing the serial serial port. The modem, serial printer, or other other serial peripheral is referred to as the Data the Data Carrier Equipment (DCE). (DCE) . The distinction becomes important because the data and handshaking signals are swapped at the DCE end. For example, the Tx pin (usually (usually on pin 3 of a 9-pin DTE) cannot cannot connect directly to the same pin on the DCE—it must must route to the Rx pin instead. The DCE connector makes those swaps, so pin 3 of the DCE would be the Rx pin, and a straight-through ca ble can be used without difficulty.
SERIAL-PORT SERIAL-PORT SIGNALS SIGNALS
1183
However, suppose that two DTEs DTEs had to be connected. Because both devices carry the same signals on the same pins, a straight-through cable would cause confusion (e.g., the Tx line would connect to the Tx line on the other device, Rx would connect to Rx, etc.). As you can imagine, two DTEs DTEs can not be connected with a straight-through straight-through cable. Of course, a specialized cable cable can be built containing the proper wire wire swaps, but an easier alternative is simply to use a null-modem, which plugs into one end of the straight-through cable. The null-modem is little little more than a jumper box that contains all of the proper swaps. This allows two DTEs to work as if one were a DTE DTE and one were a DCE.
Serial-Port Serial-Port Signals IBM and compatible PCs implement a serial port as either a 25-pin or 9-pin sub-miniature D-type connector connector (Fig. 40-3). 40-3). Both ends of the serial cable cable are identical. identical. Be concerned with three types of signals in a serial connection: data lines, control (or handshaking) lines, and ground lines. Table 40-3 identifies identifies the name and description of each conductor conductor for both 25-pin and and 9-pin serial connections. Remember that that all data and control signals signals on the serial port are bi-polar.
25-pin M
FIGURE FIGURE 40-3 40-3
9-pin M
Serial port connectors.
TABLE TAB LE 40-3 SERI SERIAL AL PORT PORT CONNECT CONNECTOR OR PINOUTS PINOUTS (AT (AT THE THE PC END) END)
25-PIN CONNECTOR
9-PIN CONNECTOR
SIGNAL
DIRECTION
1
n/a
Protective ground
n/a
2
3
Tx
Transmit data
Output
3
2
Rx
Receive data
Input
4
7
RTS Request to send
Output
5
8
CTS Clear to send
Input
6
6
DSR Data set ready
Input
7
5
Signal ground
n/ a
8
1
DCD Data carrier detect
Input
9
n/a
+ Transmit current loop
Output
11
n/ a
– Transmit current loop
Output
18
n/ a
+ Receive current loop
Input
20
4
DTR Da Data terminal ready
Output
22
9
RI Ring indicator
Input
23
n/ a
DSRD Data signal-rate indicator
I /O
25
n/ a
– Receive current loop
Input
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1184 1184
SE SERI RIAL AL (RS2 (RS232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
TX AND RX Rx and Tx are simply the data lines into and out of the port. Tx is the Transmit line, Transmit line, which outputs serial data from the PC, and Rx Rx is the Receive the Receive line, which accepts serial data from the serial peripheral.
RTS AND CTS The RTS The RTS (Request to Send) signal is generated generated by the DTE. When asserted, it tells the DCE (i.e., the modem) to expect to receive data. However, the DTE can’t just dump data to DCE. The DCE must be ready to receive the data, so after the RTS line line is asserted, the DTE waits for the CTS (Clear to Send) signal back from the DCE. DCE. Once the DTE receives receives a valid CTS signal, it can begin transferring data. This RTS/CTS RTS/CTS handshake forms the basis for data flow control.
DTR AND DSR When the DTE is turned on or initialized and ready to begin serial operation, the DTR (Data Terminal Ready) line line is asserted. This tells the DCE (i.e., (i.e., modem) that the DTE (i.e., computer) is ready ready to establish a connection. When the DCE has initialized initialized and is ready for a connection, it will assert the DSR (Data (Data Set Ready) line back to the DTE. Once the DTE is ready ready and recognizes the DSR DSR signal, a connection connection is established. This DTR/DSR handshake is established only once when the DTE and DCE devices are first initialized, and it must remain remain active throughout the connection. If either the DTR or DSR signal should fall, the communication channel will be interrupted (and the RTS/CTS handshake will no longer have any effect).
DCD DC D The DCD The DCD (Data Carrier Detect) signal is particularly particularly useful with modem modems. s. It is produced by the DCE when a carrier is detected from a remote target, and the DCE is ready to establish a communications communications pathway. pathway. The DCD signal signal is then sent sent back to the DTE. DTE. Once the DCD line is asserted, it will remain so as long as a connection is established.
RI The RI The RI (Ring Indicator) signal is asserted by the DCE, and is also particularly useful with modems. It is produced produced by the DCE DCE when a telephone telephone ring is detected. This becomes a vital signal if it is necessary for a remote user to call in and access your computer (i.e., a BBS configuration).
IrDA Port Issues A growing number of desktop and laptop PCs (and their peripherals) are being equipped with infrared ports (dubbed “IrDA” “IrDA” by the Infrared Desktop Association). Association). IrDA ports allow PCs and peripherals to communicate serially over an infrared link, rather than going
IrDA IrDA PORT PORT ISSUES ISSUES
1185 1185
through the hassle of using using cables. For example, you can type type a document on a laptop, then move the laptop into the vicinity of an IrDA printer and print the document without ever attaching a cable. Although IrDA ports ports offer some real connectivity connectivity benefits to PC users, they also present some problems with installation installation and configuration. Windows 95 requires IrDA drivers to be loaded on the system.
INSTALLING THE IRDA DRIVER(S) If you already have a PC fitted with IrDA support, you simply need to use the Add new hardware wizard to install a new set of drivers, or use the Add the Add infrared device wizard from the IR icon in the Control panel . If you’ll be installing installing IrDA support for the first first time, download the newest IR drivers from the Microsoft Web site (http://www.microsoft.com ), and run SETUP.EXE: When the Add the Add infrared device wizard prompts to choose a manufacturer’s name for the IR device, choose Standard infrared devices if the computer has a built-in device or choose the name of the manufacturer and the model of the adapter if an IR adapter is attached to the the computer. Click the Next the Next button. button. the Add infrared device wizard prompts to choose the communications port that s When the Add the IR device is physically connected to, click the port from the list. If you’re uncertain which physical communications port the IR device is using, select the first COM port in the list (for example, COM1), then click the Next button. button. s When the Add the Add infrared device wizard prompts to select the virtual COM and LPT ports, accept the default values by clicking the Next the Next button. button. After the wizard copies the IR communications driver files to the hard disk, watch for the wizard to display two New two New hardware found messages. found messages. s When prompted by the Add the Add infrared device wizard, click the Finish the Finish button button to complete the IR device installation (if the wizard did not display New display New hardware found found messages, messages, then restart the computer). s Activate the IR device by doubleclicking the Infrared the Infrared icon icon in the Control panel . If no Infrared icon Infrared icon is in the Control panel , select the Refresh the Refresh option from the Control panel view menu (or press the function key) to make the Infrared the Infrared icon icon appear. s
The next step is to test the IR device. The easiest and quickest quickest way to do this is to print over an IrDA link to an IR printer or exchange data between two computers using the IR link (and a communications application, such as LapLink). You must always remove any previously installed version of the IrDA communications driver before installing a new driver. driver. For example, if an early beta release of the the version 2.0 driver is installed, it must be removed before installing the current Version 2.0 release.
REMOVING THE IRDA DRIVER(S) In some instances, it might be necessary to remove the IR communication drivers (most often when upgrading the drivers or IR adapter hardware). The IR communication drivers
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1186 1186
SE SERI RIAL AL (RS2 (RS232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
can be removed either by using Add/remove using Add/remove programs in the Control panel or panel or by using the Device manager. manager . Using Add/remove Using Add/remove programs in the Control panel : s s s s
Click the Start button button and select the Settings option, then select Control panel . Doubleclick Add/remove Add/remove programs in the Control panel . When a list of software components is displayed, select the Infrared the Infrared support for Windows 95 entry and click the Add/remove the Add/remove button. button. Restart the system when prompted to do so. Using Device Using Device manager: manager :
s s
s
s
Right-click on the My computer icon, select the Properties option from the popup menu, then click the Device the Device manager tab in the System properties dialog. To display the name of the infrared device installed on the computer, be sure that the “View devices by type” option is selected in the System properties dialog. Then click the plus sign to the left of the Infrared device class label. label. Select the the infrared device name, then click the Remove the Remove button. button. Click OK Click OK to to confirm the the device removal. removal. After the Device the Device manager has successfully removed the infrared device installation from the computer, the Infrared device class label will disappear from the System properties dialog. Click the Close button. Close button.
The Infrared monitor icon monitor icon might still be displayed in the Windows 95 status bar (even after the infrared device is removed). Ignore it—the infrared monitor cannot be used to establish an IR link after the infrared device is removed.
IRDA TIPS Although IR support is reasonably automatic under Windows 95, a number of tips can make your troubleshooting a bit easier: Always remove the existing IR drivers before installi ng new IR drivers (or upgrading the IR adapter hardware). Pre-existing drivers can sometimes interfere with new IR drivers. s If you upgrade the IR adapter hardware on your system, you must remove the IR drivers and install new drivers. s Be sure to select the proper COM port for the IR adapter. If you select the wrong COM port during installation, the system will be unable to use the IR adapter. s IR communication problems might require you to realign the IR devices so that they are closer together (usually (usually 3' or less), and in a direct line of sight. You might need to try new batteries in the IR adapter. s If an IR adapter is attached to a COM port that is using an older 8250 UART instead of a 16550A UART (or if an IR adapter is connected to a relatively slow computer, such as a 386 running at 20MHz), you might need to use the Limit the Limit connection speed to option in the Infrared the Infrared monitor options tab to limit the connection speed to 19.2kbps. After establishing a successful IR connection at this speed, you can use the Limit connection speed to option to experiment with higher-speed connections. s
TROUBL TROUBLESH ESHOOT OOTING ING THE SERIAL SERIAL PORT PORT
s
s
s
1187 1187
Communication over a virtual COM port link between two computers might not be reliable if a printer’s printer’s IR adapter is also within within range. Be sure to move the printer’s printer’s IR adapter (or any other non-essential IR adapter) out of range. Do not suspend a Windows 95 computer while an IR connection connection is established. Wait until the IR link is disconnected (or force a disconnection) before putting the computer in suspend mode. For example, if an IrLan IrLan connection is established established on a laptop, you must always move the laptop out of range of the IrLan access point before suspending the system or closing the laptop laptop lid. Otherwise, the connection connection remains active and can drain the battery over time. Connecting and disconnecting over a low-speed IR link (or over a poor-quality link) can take a few seconds—during seconds—during which time the screen will will appear to be frozen. To work around this, you should use a higher-speed connection and take steps to improve the quality of the connection.
Troubleshooting the Serial Port Although the typical serial port is a rather simple I/O device, it presents some special challenges for the technician. Older PCs provided their serial serial ports in the form of 8-bit expansion boards. When a port failed, it was a simple matter matter to replace the board outright. outright. Today, however, virtually all PCs provide at least one serial port directly on the mother board—usually integrated integrated into a component of the main chipset. chipset. When a problem is detected with a motherboard serial port, a technician often has three choices: Replace the UART (responsible for virtually all serial port failures) on the mother board. This requires access to surface-mount surface-mount soldering tools and replacement replacement ICs, and can be quite economical in volume. s Set the motherboard jumpers (if possible) to disable the defective serial port, and install an expansion board (such as a “multi-I/O” board) to take the place of the defective port. This assumes that there is an available expansion slot. s Replace the motherboard motherboard outright. This simple tactic tactic requires little overhead overhead equipment, but can be rather expensive. s
Virtually all commercial diagnostics are capable of locating any installed serial ports, and testing the ports thoroughly through a loopback plug. Now that you have reviewed the layout, signals, and operation of a typical serial p ort, you can take a clear look at porttroubleshooting procedures.
SERIAL-PORT SERIAL-PORT CONFLICTS Hardware and software conflicts with a system’s serial ports are some of the most recurring and perplexing problems in PC troubleshooting. troubleshooting. Although PC purists are pleased that current operating systems and BIOS supports four COM ports, they cannot overcome the fact that there are still only two interrupts available available to run the ports from. Technicians trying to upgrade a PC often encounter problems adding I/O adapters because many current PC motherboards already already provide two COM ports right out of the factory. If a PC offers
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1188 11 88
SERI SE RIAL AL (R (RS2 S232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
only one COM port (e.g., COM1) and another serial port is placed in the system (by accident or on purpose), be aware that you must choose a port and IRQ that does not conflict with the existing port (i.e., COM 2 or COM4). If the PC already provides two COM ports (i.e., COM1 and COM2), adding a third COM port to the system will cause a hardware conflict. You can rectify the conflict by disabling disabling the new COM port, or by disabling one of the two existing COM ports and jumpering the new COM port to those settings. Serial device drivers can also be a source of problems for COM ports. Incorrectly written mouse drivers, printer drivers, or third-party interrupt handlers can leave a port inoperative or erratic. If problems develop after a new driver is installed, installed, disable the driver’s reference in CONFIG.SYS or install an updated protected-mode driver under Windows 95 using the Add the Add new hardware wizard. TSRs (often loaded in AUTOEXEC.B AUTOEXEC.BAT) AT) can cause problems as well. If problems develop after a new TSR is installed, disable the offending offending TSR and try the system again. Remember that drivers and TSRs TSRs can easily be disabled by adding the REM statement before the command line in CONFIG.SYS or AUTOEXEC.BAT. AUTOEXEC.BAT. If the communication trouble is under Windows 95, strongly suspect the Windows communication package, or the Registry the Registry might need to be adjusted for an optimum modem-initialization string.
MATCH THE SETTINGS It’s bad enough that you can only (practically) use two COM ports, but you also have to be sure that the port addresses and IRQ assignments assignments match (Table (Table 40-1). For example, supsup pose that no COM1 is at 03F8h, but a COM port is at 02F8h. During system initialization, initialization, BIOS locates each available port and assigns a COM designation, so because no port is at 03F8h, the port at 02F8h (normally COM2) is the first port detected, and is assigned as COM1. However, DOS and BIOS BIOS expect COM1 to use IRQ4, but the port at 02F8h 02F8h uses IRQ3. If you attempt to use BASIC or DOS for COM1, the standard interrupt handlers handlers will not work. You would have to use communication communication software that that talks to the port directly directly (thus avoiding using DOS-interrupt handlers) and can be assigned with the address and IRQ setting of your choosing. choosing. As an alternative, you can switch switch the COM port to 03F8h and set the interrupt to IRQ4—that should restore normal COM1 operation through DOS.
FRAME IT RIGHT The data frame and rate play very very important roles in serial serial communication. The sending and receiving ends of the serial link must be set to the same configuration. Otherwise, the received data will be interpreted as garbage. garbage. If you encounter such troubles, troubles, be sure to check the settings for data bits, bits, parity bit, stop bits, bits, and baud rate. Change the data frame at either end of the serial link so that all devices are running with the same parameters.
FINDING A PORT ADDRESS WITH DEBUG You can use the DOS Debug utility utility to determine the I/O addresses addresses of a serial port. Be sure that you boot the computer in the DOS mode, then switch to the directory containing the Debug utility utility (such as C:). Type: C: debug
TROUBL TROUBLESH ESHOOT OOTING ING THE SERIAL SERIAL PORT PORT
1189 1189
A hyphen will appear. This is the Debug Debug prompt. At the debug prompt, prompt, type: D 40:00 09
A single line of text appears, such as: 0040:0000
F8 03 F8 02 00 00 00 00-78 03
To exit Debug, press Q (to quit), then press to leave Debug and return to the DOS prompt. The line of interest begins 0040:0000. In this example, example, the F8 03 (read 03F8h) and F8 02 (read 02F8h) indicate two two serial ports (COM1 and COM2). COM2). Other possibilities possibilities include E8 03 (read 03E8) and E8 02 (read 02E8)—these are COM3 and COM4, respectively. A machine with four serial serial ports should read: 0040:0000
F8 03 F8 02 E8 03 E8 02-78 03
A machine with no serial ports should read: 0040:0000
00 00 00 00 00 00 00 00-78 03
The –78 03 entry is the address of the first parallel port (read 0378h).
GENERAL SYMPTOMS Your companion CD contains a variety of tools for identifying and diagnosing COM ports. The BBX201.ZIP utility offers offers a “breakout box” type of display, and you will find CTSSPU22.ZIP to be an excellent all-around utility. Other serial utilities utilities include: COMPRT25.ZIP, COMRESET.ZIP, COMTAP21.ZIP, COMTEST.ZIP, SIMTRM.ZIP, and UARTTS.ZIP. Symptom 40-1. You hear a beep code or see a POST error, which indicates a serial-port fault The system initialization might or might not halt, depending
on how the BIOS is written. Low-level initialization initialization problems generally indicate trouble in the computer’s hardware. hardware. If the computer’s beep code sequence sequence is indistinct, you could try rebooting the computer computer with a POST analyzer analyzer card installed. The BIOS POST POST code displayed on the card could be matched to a specific error explanation in the POST card’s documentation. Once you have clearly identified identified the error as a serial-port serial-port fault, you can proceed with troubleshooting. Start with the system as a whole and remove any expansion boards that have serial ports available. Retest the computer computer after removing removing each board. If the error disappears disappears after removing a particular card, then that card card is likely at fault. You can simply replace the card with a new one or attempt to repair repair the card to the component level. If only one serial port is in the system, it is most likely built into the motherboard. Again, you can replace the defective UART, replace the motherboard or disable the defective motherboard port. Symptom 40-2. An 11xx or 12xx serial adapter error is displayed A hard-
ware fault has been detected in one of the COM ports. The 11xx errors typically indicate indicate
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G
1190 1190
SE SERI RIAL AL (RS2 (RS232 32)) POR PORT T TRO TROUB UBLE LESH SHOO OOTI TING NG
a fault in COM1, while 12xx errors errors suggest a problem with COM2, COM3, COM3, or COM4. In most cases, the fault is in the UART. UART. You have the option whether to replace the UART UART IC, replace the motherboard, or disable the defective COM port and replace it with an ex pansion board. Symptom 40-3. The computer initializes properly, but the serial peripheral does not work Your applications software might indicate that no device is con-
nected. Before you even open your tool kit, you must determine whether the trouble trouble lies in your computer or your peripheral. peripheral. When your modem or printer printer stops working, run a self test to ensure the device is at at least operational. Check all cables and connectors connectors (perhaps try a different cable). Also be sure to check the software package being being used to operate the serial port. Ensure that the software software is configured properly to use the appropriate appropriate COM port and that any necessary drivers are selected. Disconnect the peripheral at the computer and install a serial loopback plug. Run a diagnostic to inspect each available serial port. Take note of any port(s) that register as defective. Locate the corresponding serial port. If the port is installed as an expansion board, replace the defective expansion board. If the port is on the motherboard, you can replace the defective UART IC, install an alternate expansion board or replace the motherboard outright. Symptom 40-4. Data is randomly lost or garbled Your first step should be to
check the communication cable. cable. Be sure that the cable is intact intact and properly secured at both ends. Try a different cable. If the cable checks properly, properly, either the port port or peripheral is at fault. Start by suspecting the serial serial port. Be sure that the DTE and DCE are both set to use the same data fr frame ame and data rate. Incorrect settings settings can easily garble data. data. If problems persist, disconnect the printer at the computer computer and install a serial loopback plug. Run a diagnostic to inspect each available serial port. Take note of any port(s) that register as defective. Locate the corresponding corresponding serial port(s). If the port is installed as an expansion expansion board, replace the defective defective expansion board. If the port is on the motherboard, motherboard, you can replace the defective port-controller IC, install an alternate expansion board, or replace the motherboard outright. If you can not test the computer’s serial port directly, test the port indirectly by trying the peripheral on another known-good computer. computer. If the peripheral works properly properly on another computer, the trouble is probably in the original original computer’s serial-port serial-port circuitry. Replace any defective circuitry or replace the motherboard. motherboard. If the peripheral remains defective on another computer, the peripheral itself (i.e., printer or modem) is probably faulty. Symptom 40-5. LapLink does not recognize the IR COM port When you at-
tempt to use LapLink with virtual COM ports created by an infrared adapter, you might receive the following error message: This port is unavailable: it might not be physically present in this computer. If no other communications program is currently running, check for a mouse or other serial device on this port.
This problem occurs because LapLink accesses the hardware directly to determine the status of the COM port and does not recognize virtual COM ports created using the infrared
FURTHER FURTHER STUDY
1191
adapter. To work around this problem, problem, you’ll need to contact contact Traveling Software Software for a possible patch for LapLink or discard the use of LapLink in favor of the Direct the Direct Cable Connection (DCC) tool included with Windows 95. Symptom 40-6. Problems occur when maintaining an IR connection in the daylight This problem is common with all infrared devices, and is usually caused by “in-
terference” from the natural natural IR component of ordinary sunlight. sunlight. Try shortening the transmission distance between the transmitter and receiver, and be sure that the path between the two is as straight as possible.
Further Study This concludes the material material for Chapter 40. Be sure to review the glossary and chapter questions on the accompanying CD. CD. If you have access to the Internet, take a look at some of these serial-port resources: Adaptec: http://www.adaptec.com ActiSys: http://www.actisys.com TI: http://www.ti.com Sharp: http://www.sharp.com HP: http://www.hp.com
2
S Y S T E M D A T A A N D T R O U B L E S H O O T I N G