Download pdf - RS232 Wiring Diagrams

Transcript
Page 1: RS232 Wiring Diagrams

RS232 Wiring Diagrams

The unfortunate thing about RS232 is that aside from the simplest TD to RD and SG to SG hookups, and computer to modems (essentially straight through because a modem is DCE- just the reverse of a computer), everybody does it differently. For the diagrams below, leave off FG when you don't have it (DB9).

Async modems need FG (if available), SG, TD, RD, CTS, RTS, DSR, DCD and DTR at a minimum. Synchronous modems also need SCTS, STD, TC, RC, RI and (TC).

Meanings of pins in DB25 order:

DB25 Pin DB9 Pin Description 1 FG Frame Ground 2 3 TD Transmit data (Out) 3 2 RD Receive data (In) 4 7 RTS Request to Send (Out) 5 8 CTS Clear to Send (In) 6 6 DSR Data Set Ready (In) 7 5 SG Signal Ground 8 1 DCD Data Carrier Detect (In) 9 +V (In)

10 -V (In) 11 QM (also called SSD- Secondary Send Data)(In) 12 SDCD Secondary Carrier Detect (In) 13 SCTS Secondary Clear to Send (In) 14 STD Secondary Transmit Data (Out) 15 TC Transmitter Clock (In) 16 SRD Secondary Receive Data (In) 17 RC Receiver Clock (In) 18 Unused 19 SRTS Secondary Request to Send (Out) 20 4 DTR Data Terminal Ready (Out) 21 SQ Signal Quality Detect (In) 22 9 RI Ring Indicator (In) 23 Data Rate Select (Out) 24 (TC) External Transmitter Clock (Out) 25 Unused

Meanings of pins in DB9 order:

DB25 Pin DB9 Pin Description 8 1 DCD Data Carrier Detect (In) 3 2 RD Receive data (In) 2 3 TD Transmit data (Out)

20 4 DTR Data Terminal Ready (Out) 7 5 SG Signal Ground

Page 2: RS232 Wiring Diagrams

6 6 DSR Data Set Ready (In) 4 7 RTS Request to Send (Out) 5 8 CTS Clear to Send (In)

22 9 RI Ring Indicator (In)

Connecting to other devices

There is tremendous variance in printer wiring. If you don't know how your printer expects to be wired, you'll have to wire it just TD,RD and SG, and rely on Xon/Xiff flow control.

Some printers handshake with RTS and use DTR to indicate on-line or off-line.

Computer Printer (handshake DTR and CTS) FG FG RD TD TD RD

DCD RTS RTS DCD

CTS and DSR DTR DTR CTS and DSR SG SG

Others use DTR for everything

Computer Printer (handshake DTR) FG FG RD TD TD RD

CTS, DCD and DSR DTR DTR CTS, DCD and DSR SG SG

Okidata printers have an unusual setup:

Computer Okidata Serial Printer FG FG RD TD TD RD

CTS QM DSR DTR and DSR SG SG

Connecting a computer to another computer needs only TD, RD and SG if you are using Xon/Xoff flow control.

Computer Terminal or Computer FG FG RD TD

Page 3: RS232 Wiring Diagrams

TD RD RTS CTS CTS RTS

DCD and DSR DTR DTR DCD and DSR SG SG

RS232 serial cables pinout

RS232 serial connector pin assignment RS232 DB9 to DB25 converter RS232 serial loopback test plugs RS232 null modem cables Spy / monitor cable Serial printer cables Yost RS232 on RJ45 standard RS232 support forum New

RS232 serial cable layout Almost nothing in computer interfacing is more confusing than selecting the right RS232 serial cable. These pages are intended to provide information about the most common serial RS232 cables in normal computer use, or in more common language "How do I connect devices and computers using RS232?"

RS232 serial connector pin assignment The RS232 connector was originally developed to use 25 pins. In this DB25 connector pinout provisions were made for a secondary serial RS232 communication channel. In practice, only one serial communication channel with accompanying handshaking is present. Only very few computers have been manufactured where both serial RS232 channels are implemented. Examples of this are the Sun SparcStation 10 and 20 models and the Dec Alpha Multia. Also on a number of Telebit modem models the secondary channel is present. It can be used to query the modem status while the modem is on-line and busy communicating. On personal computers, the smaller DB9 version is more commonly used today. The diagrams show the signals common to both connector types in black. The defined pins only present on the larger connector are shown in red. Note, that the protective ground is assigned to a pin at the large connector where the connector outside is used for that purpose with the DB9 connector version.

The pinout is also shown for the DEC modified modular jack. This type of connector has been used on systems built by Digital Equipment Corporation; in the early days one of the leaders in the mainframe world. Although this serial interface is differential (the receive and transmit have their own floating ground level which is not the case with regular RS232) it is possible to connect RS232 compatible devices with this interface because the voltage levels of the bit streams are in the same range. Where the definition of RS232 focussed on the connection of

Page 4: RS232 Wiring Diagrams

DTE, data terminal equipment (computers, printers, etc.) with DCE, data communication equipment (modems), MMJ was primarily defined for the connection of two DTE's directly.

RS232 DB9 pinout

DEC MMJ pinout

RS232 DB25 pinout

RS232 DB25 to DB9 converter

The original pinout for RS232 was developed for a 25 pins sub D connector. Since the introduction of the smaller serial port on the IBM-AT, 9 pins RS232 connectors are commonly used. In mixed applications, a 9 to 25 pins converter can be used to connect connectors of different sizes. As most of the computers are equipped with the DB9 serial port version, all wiring examples on this website will use that connector as a default. If you want to use the example with a DB25, simply replace the pin numbers of the connector according to the conversion table below.

RS232 DB9 to DB25 converter

DB9 - DB25 conversion

Page 5: RS232 Wiring Diagrams

DB9 DB25 Function

1 8 Data carrier detect

2 3 Receive data

3 2 Transmit data

4 20 Data terminal ready

5 7 Signal ground

6 6 Data set ready

7 4 Request to send

8 5 Clear to send

9 22 Ring indicator

RS232 serial loopback test plugs The following RS232 connectors can be used to test a serial port on your computer. The data and handshake lines have been linked. In this way all data will be sent back immediately. The PC controls its own handshaking. The first test plug can be used to check the function of the RS232 serial port with standard terminal software. The second version can be used to test the full functionality of the RS232 serial port with Norton Diagnostics or CheckIt.

RS232 loopback test plug for terminal emulation software

DB9 DB25 Function

1 + 4 + 6 6 + 8 + 20 DTR CD + DSR

2 + 3 2 + 3 Tx Rx

7 + 8 4 + 5 RTS CTS

Page 6: RS232 Wiring Diagrams

RS232 loopback test plug for Norton Diagnostics and CheckIt

DB9 DB25 Function

1 + 4 + 6 + 9 6 + 8 + 20 + 22 DTR CD + DSR + RI

2 + 3 2 + 3 Tx Rx

7 + 8 4 + 5 RTS CTS

Testing occurs in a few steps. Data is sent on the Tx line and the received information on the Rx input is then compared with the original data. The signal level on the DTR and RTS lines is also controlled by the test software and the attached inputs are read back in the software to see if these signal levels are properly returned. The second RS232 test plug has the advantage that the ring-indicator RI input line can also be tested. This input is used by modems to signal an incoming call to the attached computer.

RS232 null modem cables The easiest way to connect two PC's is using an RS232 null modem cable. The only problem is the large variety of RS232 null modem cables available. For simple connections, a three line RS232 cable connecting the signal ground and receive and transmit lines is sufficient. Depending of the software used, some sort of handshaking may however be necessary. Use the RS232 null modem selection table to find the right null modem cable for each purpose. For a Windows 95/98/ME Direct Cable Connection, the RS232 null modem cable with loop back handshaking is a good choice.

RS232 null modem cables with handshaking can be defined in numerous ways, with loopback handshaking to each PC, or complete handshaking between the two systems. The most common null modem cable types are shown here.

Simple RS232 null modem without handshaking (Null modem explanation)

Page 7: RS232 Wiring Diagrams

Connector 1 Connector 2 Function

2 3 Rx

Tx

3 2 Tx

Rx

5 5 Signal ground

RS232 null modem with loop back handshaking (Null modem explanation)

Connector 1 Connector 2 Function

2 3 Rx Tx

3 2 Tx Rx

5 5 Signal ground

1 + 4 + 6 - DTR CD + DSR

- 1 + 4 + 6 DTR CD + DSR

7 + 8 - RTS CTS

- 7 + 8 RTS CTS

RS232 null modem with partial handshaking (Null modem explanation)

Connector 1 Connector 2 Function

1 7 + 8 RTS2 CTS2 + CD1

2 3 Rx Tx

Page 8: RS232 Wiring Diagrams

3 2 Tx Rx

4 6 DTR DSR

5 5 Signal ground

6 4 DSR DTR

7 + 8 1 RTS1 CTS1 + CD2

RS232 null modem with full handshaking (Null modem explanation)

Connector 1 Connector 2 Function

2 3 Rx Tx

3 2 Tx Rx

4 6 DTR DSR

5 5 Signal ground

6 4 DSR DTR

7 8 RTS CTS

8 7 CTS RTS

RS232 Pin Assignments (DB25 PC signal set)

Pin 1 Protective Ground

Pin 2 Transmit Data

Pin 3 Received Data

Pin 4 Request To Send

Pin 5 Clear To Send

Pin 6 Data Set Ready

Page 9: RS232 Wiring Diagrams

Pin 7 Signal Ground

Pin 8 Received Line Signal Detector (Data Carrier Detect)

Pin 20 Data Terminal Ready

Pin 22 Ring Indicator

The connector on the PC has male pins, therefore the mating cable needs to terminate in a DB25/F (Female pin) connector.

RS232 Pin Assignments (DE9 PC signal set)

Pin 1 Received Line Signal Detector (Data Carrier Detect)

Pin 2 Received Data

Pin 3 Transmit Data

Pin 4 Data Terminal Ready

Pin 5 Signal Ground

Pin 6 Data Set Ready

Pin 7 Request To Send

Pin 8 Clear To Send

Pin 9 Ring Indicator

The connector on the PC has male pins, therefore the mating cable needs to terminate in a DE9/F (Female pin) connector.

Wiring up something nice and simple, for instance a plain old "dumb terminal", is just a matter of connecting Tx, Rx and Ground, right?

Usually Not. While the normal PC hardware might well run with just Tx, Rx and Ground connected, most driver software will wait forever for one of the handshaking lines to go to the correct level. Depending on the signal state it might sometimes work, other times it might not. The reliable solution is to loop back the handshake lines if they are not used.

Page 10: RS232 Wiring Diagrams

Handshake looping a PC serial connector

When the lines are handshake looped, the RTS output from the PC immediately activates the CTS input - so the PC effectively controls its own handshaking.

RS232 DE9 PC Loopback test

plug

The PC loopback plug is a useful diagnostic tool. The loopback plug connects serial inputs to serial outputs so that the port may be tested. There is more than one way to wire up a loopback plug - but this is the most common.

Page 11: RS232 Wiring Diagrams

RS232 DB25 PC Loopback test

plug

Connecting together two serial devices involves connecting the Rx of one device to the Tx of the other, and vice versa. The diagram below indicates how you would go about connecting two PC's together, without handshaking.

Connecting two PCs together using RS232, without handshaking

When Handshaking is required, generally RTS of one device connects to CTS of the other, and vice versa, and also DSR of one device connects to DTR of the other device, and vice versa. The particular requirements for different equipment may vary.

Page 12: RS232 Wiring Diagrams

Connecting two PCs together using RS232, with handshaking

Using a Breakout box or LED box to work out cabling If you have problem with RS232 cabling, your best "emergency" tool may be a breakout box (sometimes called an LED box). The normal over-the-counter units only come in the DB25 size, but with a couple of DB9 to DB25 adaptors, they can be used with DB9 cables as well. The units have an LED for each signal line in the cable, and the LED lights green or red dependent on the signal state. The Breakout box also allows you to disconnect certain lines in the cable, and patch in new ones - good for trying new cable wiring possibilities.

The first thing to remember, is that there is a good chance the two devices you are trying together will actually work if you can get the cable correct. If you have some other way to actually prove this - for instance by trying each of the devices on another system - do it.

Given a hypothetical example - for instance connecting a standard PC with a DB25M to a 200 disk CD changer with a DB25M, the first thing I would try and do is get a cable that I think would work. In this instance, I would either purchase or build a null-modem cable (DB25F to DB25F) - similar to the last example, basically the cable used to connect two PCs together with handshaking, only DB25F to DB25F instead of DB9F to DB9F.

Given the cable that I believe will work, connect the cable, LED box and two devices all together. Before powering on both devices, unplug just one of them. Power the devices on and make a note of which LEDs are lit. Then unplug the connected device and plug in

Page 13: RS232 Wiring Diagrams

the disconnected one, without rearranging the cabling otherwise. Again make a note of which LEDs are lit. If any single LED is lit by both of the devices, then there is an output conflict, and the cable wiring is incorrect. By this, I mean that one line in the cable has an output driving it from both ends - and this is not correct for RS232 - so that means that the cable wiring is not correct for the devices. Pay particular attention to Tx and Rx.

To continue with the example above, if I saw that two ends were driving the same lines, I would assume the null modem cable was not correct, and I would try a one-for-one gender changer instead.

If each end drives its own set of LEDs, connect the two ends together. In normal situations, you should see all the LEDs light up - but there are some devices which will not light up all the LEDs. Having said that, if one of the devices is a PC and any LED except RI (Ring indicator) is not lit up, the cable will probably not work.

Normally, other cabling problems will involve handshake lines. An LED box will be an invaluable guide, but there is no trivial test to determine the solution. An LED Box will also show the lines as they change state, although it is usually quite hard to see the serial communications themselves unless the comms are continuous, or at a low baud rate (9600 baud or lower is usually visible).

Using a 'T' plug and a PC to monitor comms

The gadget below is a quick 10 minute project that is really great for monitoring RS232 Comms using a PC.

A gadget for monitoring RS232 Comms between two devices

There are three sockets on our monitoring gadget. Two of them are connected straight through - you plug them in series with the devices you wish to monitor - and the third goes off to another monitoring PC.

Page 14: RS232 Wiring Diagrams

The monitoring PC "Sees" on its serial port both sides of the serial conversation - that is it sees what is sent by PC1 and also what is sent by PC2. This can be a positive advantage, because you can see the serial conversation as it progresses between the two devices. Some serial protocols, however, talk "full duplex" meaning that one end can start transmitting while it is still receiving from the other end. This unit cannot monitor full duplex Comms - you will see gobble-dee-gook where the two transmissions overlap.

If you try this unit, you will be surprised how useful it is, and how often it works - mostly because many supposedly full duplex installations still talk half duplex in any case, because that is the sensible way to write the software. Not bad for one diode and a resistor, huh?


Recommended