Professional Documents
Culture Documents
Serial-Port Signals
TX and RX RTS and CTS DTR and DSR DCD RI
Further Study
1177
dustry Association (EIA) developed a standard for serial 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. The EIA denoted its serial standard as RS-232 (or simply the serial port). A serial port offers several distinct advantages over early parallel ports. First, the serial port was designed to be bi-directional, right from the start. This made serial the preferred method for interactive devices, such as modems, mice, etc. Second, the serial port used fewer physical signal lines than the parallel port. This made cabling less expensive and reduced potential connector problems. Where a printer cable is generally limited to two meters in length, a serial cable can easily exceed 60 meters. This difference opened the way for basic local networking. This chapter shows you the essential concepts of serial communication and port operation, then guides you through a series of troubleshooting procedures.
2
SYSTEM DATA AND TROUBLESHOOTING
1178
V Logic 0 (space)
1 V Logic 1 (mark)
0 S t a r t b i t
1 P a r i t y b i t
0 S t o p b i t (s)
Data bits
FIGURE 40-1
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. The exact number of bits (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 error-checking bit (called a parity bit) can be included, if desired. Parity is calculated at the sending device and sent with the word. Parity is also calculated at the receiving device and checked against the received parity bit. If the two match, the data is assumed to be correct. If the two do not match, an error is flagged. There are five classes of parity:
s None No parity bit is added to the word. This is typical for much of todays serial com-
munication.
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. Many communication connections today abandon the use of parity in favor of the more reliable and sophisticated Cyclical Redundancy Check (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), the line remains idle in the space condition, awaiting the next subsequent start bit. Framing is
1179
usually denoted as data/parity/stop. For example, the 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 communication 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 (both positive and negative voltages). The advantage of bi-polar signaling is that it supports very long cabling with minimum noise. A logic 0 (space) condition is represented by a positive voltage between +3 Vdc and +15 Vdc. A logic 1 (mark) condition is represented by a negative voltage between 3 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.
2
SYSTEM DATA AND TROUBLESHOOTING
1180
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.
Tx logic
Tx shift reg.
Line driver
Tx
Rx buffer
Rx logic
Rx shift reg.
Line receiver
Rx
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.
2
SYSTEM DATA AND TROUBLESHOOTING
1182
TABLE 40-2 TYPICAL UART REGISTER ADDRESS OFFSETS REGISTER Receive register Transmit register Interrupt enable register Interrupt ID register Data frame register UART control register Serialization status register UART status register General-purpose register OFFSET 00h 00h 01h 02h 03h 04h 05h 06h 07h
The use of interrupts in conjunction with COM ports can easily be 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 expanded its support for additional COM ports, no extra IRQ lines were available to assign. Thus, COM ports had to share interrupts. For example, COM1 and COM3 must share IRQ4, while COM2 and COM4 must share IRQ3. The problem is that no two devices can use the same IRQ at the same timeotherwise, a system conflict will result. Ultimately, 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 port address and IRQ lines must 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 and easy to add to various expansion cards that you 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 COM ports by removing the offending port or disabling it through jumpers or DIP switches.
SERIAL-PORT SIGNALS
1183
However, suppose that two 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 can not be connected with a straight-through cable. Of course, a specialized cable can be built containing the proper 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 more than a jumper box that contains all of the proper swaps. This allows two DTEs to work as if one were a DTE and one were a DCE.
Serial-Port Signals
IBM and compatible PCs implement a serial port as either a 25-pin or 9-pin sub-miniature D-type connector (Fig. 40-3). Both ends of the serial cable are 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 the name and description of each conductor for both 25-pin and 9-pin serial connections. Remember that all data and control signals on the serial port are bi-polar.
2
SYSTEM DATA AND TROUBLESHOOTING
25-pin M
9-pin M
FIGURE 40-3
TABLE 40-3 SERIAL PORT CONNECTOR PINOUTS (AT THE PC END) 25-PIN CONNECTOR 1 2 3 4 5 6 7 8 9 11 18 20 22 23 25 9-PIN CONNECTOR n/a 3 2 7 8 6 5 1 n/a n/a n/a 4 9 n/a n/a
SIGNAL Protective ground Tx Transmit data Rx Receive data RTS Request to send CTS Clear to send DSR Data set ready Signal ground DCD Data carrier detect + Transmit current loop Transmit current loop + Receive current loop DTR Data terminal ready RI Ring indicator DSRD Data signal-rate indicator Receive current loop
DIRECTION n/a Output Input Output Input Input n/a Input Output Output Input Output Input I/O Input
1184
TX AND RX
Rx and Tx are simply the data lines into and out of the port. Tx is the Transmit line, which outputs serial data from the PC, and Rx is the Receive line, which accepts serial data from the serial peripheral.
DCD
The DCD (Data Carrier Detect) signal is particularly useful with modems. It is produced by the DCE when a carrier is detected from a remote target, and the DCE is ready to establish a communications pathway. The DCD signal is then sent back to the DTE. Once the DCD line is asserted, it will remain so as long as a connection is established.
RI
The RI (Ring Indicator) signal is asserted by the DCE, and is also particularly useful with modems. It is produced by the DCE when a 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).
1185
through the hassle of using cables. For example, you can 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 offer some real connectivity benefits to PC users, they also present some problems with installation and configuration. Windows 95 requires IrDA drivers to be loaded on the system.
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 computer. Click the Next button. When the Add infrared device wizard prompts to choose the communications port that the IR device is physically connected to, click the port from the list. If youre 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. When the Add infrared device wizard prompts to select the virtual COM and LPT ports, accept the default values by clicking the Next button. After the wizard copies the IR communications driver files to the hard disk, watch for the wizard to display two New hardware found messages. When prompted by the Add infrared device wizard, click the Finish button to complete the IR device installation (if the wizard did not display New hardware found messages, then restart the computer). Activate the IR device by doubleclicking the Infrared icon in the Control panel. If no Infrared icon is in the Control panel, select the Refresh option from the Control panel view menu (or press the <F5> function key) to make the Infrared icon appear.
2
SYSTEM DATA AND TROUBLESHOOTING
The next step is to test the IR device. The easiest and 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. For example, if an early beta release of the version 2.0 driver is installed, it must be removed before installing the current Version 2.0 release.
1186
can be removed either by using Add/remove programs in the Control panel or by using the Device manager. Using Add/remove programs in the Control panel:
s Click the Start button and select the Settings option, then select Control panel. s Doubleclick Add/remove programs in the Control panel. s When a list of software components is displayed, select the Infrared support for Win-
menu, then click the Device manager tab in the System properties dialog.
s 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. Select the infrared device name, then click the Remove button. s Click OK to confirm the device removal. After 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. s Click the Close button.
The Infrared monitor icon might still be displayed in the Windows 95 status bar (even after the infrared device is removed). Ignore itthe 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:
s Always remove the existing IR drivers before installing 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 dri-
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 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 connection speed to option in 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.
1187
s Communication over a virtual COM port link between two computers might not be re-
liable if a printers IR adapter is also within range. Be sure to move the printers IR adapter (or any other non-essential IR adapter) out of range. s Do not suspend a Windows 95 computer while an IR 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 connection is 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 lid. Otherwise, the connection remains active and can drain the battery over time. s Connecting and disconnecting over a low-speed IR link (or over a poor-quality link) can take a few secondsduring which time the screen 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.
2
SYSTEM DATA AND TROUBLESHOOTING
board. This requires access to surface-mount soldering tools and 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 outright. This simple tactic requires little overhead equipment, but can be rather expensive. 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 port, you can take a clear look at porttroubleshooting procedures.
SERIAL-PORT CONFLICTS
Hardware and software conflicts with a systems serial ports are some of the most recurring and perplexing problems in PC 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 to run the ports from. Technicians trying to upgrade a PC often encounter problems adding I/O adapters because many current PC motherboards already provide two COM ports right out of the factory. If a PC offers
1188
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 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, disable the drivers reference in CONFIG.SYS or install an updated protected-mode driver under Windows 95 using the Add new hardware wizard. TSRs (often loaded in AUTOEXEC.BAT) can cause problems as well. If problems develop after a new TSR is installed, disable the offending TSR and try the system again. Remember that drivers and TSRs can easily be disabled by adding the REM statement before the command line in CONFIG.SYS or AUTOEXEC.BAT. If the communication trouble is under Windows 95, strongly suspect the Windows communication package, or the Registry might need to be adjusted for an optimum modem-initialization string.
FRAME IT RIGHT
The data frame and rate play very important roles in 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. If you encounter such troubles, be sure to check the settings for data bits, parity bit, stop 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.
1189
A hyphen will appear. This is the Debug prompt. At the debug prompt, type:
D 40:00 09
To exit Debug, press Q (to quit), then press <Enter> to leave Debug and return to the DOS prompt. The line of interest begins 0040:0000. In this example, the F8 03 (read 03F8h) and F8 02 (read 02F8h) indicate two serial ports (COM1 and COM2). Other possibilities include E8 03 (read 03E8) and E8 02 (read 02E8)these are COM3 and COM4, respectively. A machine with four serial ports should read:
0040:0000 F8 03 F8 02 E8 03 E8 02-78 03
2
SYSTEM DATA AND TROUBLESHOOTING
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 a breakout box type of display, and you will find CTSSPU22.ZIP to be an excellent all-around utility. Other serial 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 problems generally indicate trouble in the computers hardware. If the computers beep code sequence is indistinct, you could try rebooting the computer with a POST analyzer card installed. The BIOS POST code displayed on the card could be matched to a specific error explanation in the POST cards documentation. Once you have clearly identified the error as a 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 after removing each board. If the error disappears after removing a particular card, then that card is likely at fault. You can simply replace the card with a new one or attempt to 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 hardware fault has been detected in one of the COM ports. The 11xx errors typically indicate
1190
a fault in COM1, while 12xx errors suggest a problem with COM2, COM3, or COM4. In most cases, the fault is in the UART. You have the option whether to replace the UART IC, replace the motherboard, or disable the defective COM port and replace it with an expansion 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 lies in your computer or your peripheral. When your modem or printer stops working, run a self test to ensure the device is at least operational. Check all cables and connectors (perhaps try a different cable). Also be sure to check the software package being used to operate the serial port. Ensure that the software is configured properly to use the 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. Be sure that the cable is intact and properly secured at both ends. Try a different cable. If the cable checks properly, either the port or peripheral is at fault. Start by suspecting the serial port. Be sure that the DTE and DCE are both set to use the same data frame and data rate. Incorrect settings can easily garble data. If problems persist, disconnect the printer 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(s). 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 port-controller IC, install an alternate expansion board, or replace the motherboard outright. If you can not test the computers serial port directly, test the port indirectly by trying the peripheral on another known-good computer. If the peripheral works properly on another computer, the trouble is probably in the original computers serial-port circuitry. Replace any defective circuitry or replace the 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 STUDY
1191
adapter. To work around this problem, youll need to contact Traveling Software for a possible patch for LapLink or discard the use of LapLink in favor of 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 IR component of ordinary 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 for Chapter 40. Be sure to review the glossary and chapter questions on the accompanying 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
SYSTEM DATA AND TROUBLESHOOTING