Cool new article about this on iljitsch.com 2020-02-02.
Here is a scheme which solves four of the six RS-232 hassles:
The other two hassles that remain are:
All of your cables are wired the same and have the same connectors.
Onto every serial port of every piece of equipment at your site, you screw down an appropriately-wired adaptor from DB-25 or DB-9 to RJ-45. Now every serial port has the same kind of socket: RJ-45 Female, regardless of whether its underlying connector is DB-25 or DB-9, DTE or DCE, male or female. Furthermore, every serial port now transmits and receives data and control on the same pins.
There are three signal wires for each direction: one data and two control. The control lines are used for modem control and/or hardware flow control.
The cables are not wired normally (i.e. with each connector pin connected to the corresponding pin at the other end of the cable). They are wired "with a twist", or "mirror image", or "side-to-side reversed", or whatever you want to call it. That is, pin 1 at one end of the cable goes to pin 8 on the other end, etc. (N.B. this meaning of "twist" is distinct from the use in the term "twisted pair".)
Because of the way the adaptors are wired, the "twist" cable connects each transmit pin to its corresponding receive pin at the other end of the cable. Don't use straight-through cables; they won't work at all. If you buy ready-made cable, it'll be "straight-through", and you'll have to remove the connector from one end and crimp on a new one with the wires reversed (8 to 1 and 1 to 8, etc.). Female to female RJ-45 connectors are also available for extending cable lengths, but remember, two twist cables joined with such a coupler make a straight-through cable.
Making the cables
The biggest caveat to this system is that you'll have to buy or borrow a crimping tool for making the cables.
This scheme was intended for use with jacketed ribbon cable, in which all the wires are side-by-side. "Twisted pair" cable, by contrast, has four pairs of wire, each pair twisted against itself along the cable's length. If you use twisted pair cable, such as "Category 5" cable, you should not wire your cables as one normally would for RJ-45 (e.g. for 10-Base-T, telephone, etc.). Rather you should wire them so that wires 3:4 and 5:6 make pairs. Other pairings will be susceptible to data signal crosstalk. The pairing of the remaining wires is not important, but 1:2 and 7:8 will be about as good as any.
The RS-232 standard specifies a maximum cable length of 75 feet at 9600 bits per second. Ha! In practice, lenghts of 800 to 1000 feet work just fine. If you're trying to get maximum length and/or highest speeds, be sure to heed the section above on "twisted pair cable".
Inside an RJ-45 adapter, coming from the RJ-45 socket there are 8 wires with male (or female) DB-25 (or DB-9) pins crimped onto them. You simply push these pins into the holes in the RS-232 connector and then snap the adapter housing on. The color coding of wires in RJ-45 adapters is fairly standard. The adapters are available from many electronics stores.
RJ-45 Pin Numbering
RJ-45 pins are numbered as shown on this male RJ-45 connector.
Computers and terminals are typically DTE (Data Terminal Equipment) devices.
DTE Adapter Wiring
DB-9 DB-25 Signal Function Adapter RJ-45 8 5 CTS Clear To Send Blue 1 1 8 DCD Data Carrier Detect Orange 2 2 3 RD Received Data Black 3 5 7 SG Signal Ground Red 4 5 7 SG Signal Ground Green 5 3 2 TD Transmitted Data Yellow 6 4 20 DTR Data Terminal Ready Brown 7 7 4 RTS Request To Send White 8 6 6 DSR Data Set Ready - - 9 22 RI Ring Indicator - -
The Green and Red wires in the RJ-45 adapter must be soldered or crimped together.
Some DTE devices require the DSR (Data Set Ready) signal. This signal is usually provided by the DCE device. If you have a DTE device (such as a terminal) that requires the DSR signal, wire pins 20 and 6 (4 and 6 on a DB-9 connector) together. This way, the DTE device will receive the DSR signal from itself when it asserts the DTR signal.
Modems and printers are typically DCE (Data Communications Equipment) devices.
DCE Adapter Wiring
DB-9 DB-25 Signal Function Adapter RJ-45 8 5 CTS Clear To Send White 8 1 8 DCD Data Carrier Detect Brown 7 2 3 RD Received Data Yellow 6 5 7 SG Signal Ground Green 5 5 7 SG Signal Ground Red 4 3 2 TD Transmitted Data Black 3 4 20 DTR Data Terminal Ready Orange 2 7 4 RTS Request To Send Blue 1 6 6 DSR Data Set Ready - - 9 22 RI Ring Indicator - -
The Green and Red wires in the RJ-45 adapter must be soldered or crimped together.
On some printers, pin 7 of the RJ-45 adapter (the brown wire) should be connected to the Data Set Ready (DSR) line (pin 6 on both DB-25 and DB-9). Read your printer documentation to find out if it provides useful handshaking signals on DSR instead of DCD.
The DB-9 pinouts above were incorrect on this page until corrected on Feb 26, 1998.
I have to confess that I received the DB-9 pinouts from Kenneth J. Hendrickson and I reproduced them without ever checking them or using them. Then I got email from Mark Lentczner, who said the DB-9 pinouts were backwards. I found confirmation of the correct pinouts here:
Thanks, Mark Lentczner!
Somewhere at Berkeley they use or have used different pinouts.
Some Cisco equipment uses a similar system on RJ-45 with different pinouts.
Motorola MVME embedded computer system boards
From: Fred Clegg
Date: Thu, 30 Oct 1997 13:33:20 -0800
Subject: RS-232 on RJ-45s
I thought I should alert you to the fact that your conventions conflict with those employed by Motorola on some (maybe all?) of their MVME embedded computer system boards. In particular, we use MVME-162LX boards in many of our customer training classes (look for the link to "Customer Education and Training" down near the lower righthand corner of the home page). These boards put TxD and RxD on the innermost pair and SG on the pair outside of that. I'm not suggesting that you change your conventions (since I'm sure a bunch of people are already using it). It might spare somebody some grief someday if you put a little caveat to this effect into your web page, however.
This standard is not a cable-twist system.
Subject: Crosslinks for EIA-561 standards, if you want them
Date: Tue, 13 May 2003 18:04:29 -0400
From: Andrew Kidder
To: Dave Yost
EIA/TIA 561: EIA/TIA-232D recommends this signal wiring using an RJ45 connector
http://www.tiaonline.org/standards/search_results2.cfm?document_no=TIA/EIA-561 (the standard, Dec 1998)
National Semiconductor application note 917 gives a historical background about EIA-561 and interoperability between EIA-232 and EIA-562 electrical standards.
From: Dan Symes
Date: Sat, 28 Apr 2001
I notice that Dell use RJ-11 for RS-232 in a different way.
In a bizarre way, I would say.
I put this scheme together in the summer of 1987. (Thanks to folks at UC Berkeley for the idea. Their wiring is slightly different, I gather for historical reasons, but the basic idea was there. If I can find out who really originated this scheme, I'd like to credit him or her by name.)
About 1994, the scheme was picked up for the 2nd edition of the Unix System Administration Handbook, where it was given this name. Then I found out that Kenneth J. Hendrickson made a web page out of it. He graciously gave me permission to use his HTML. What you see here is a new version which is more the way I wrote it in the first place and which corrects a glaring omission: the cables must have a "twist".
When I first published this scheme in 1987, I wrote "Maybe one day before the year 2,000, the world will have a new, simple, high-speed, flow-controlled, standard type of connection for point-to-point applications currently using RS-232, with an adaptor available to talk to old, RS-232 equipment." As I write this in 1997, we are starting to see Apple's "FireWire", a 100MBit/sec superb technology for point-to-point connections, with 200 and 400-MBit faster optional versions. And add to this the fact that the equipment that hooks up using FireWire technology is plug-and-play and can be connected or disconnected while the system is running, and you see we indeed have come a long way.
This wiring system is included in this book
Now in a new 4th Edition for 2007