How to Make a Serial Loopback Cable 20 Oct, 2009
A regular loopback serial cable just ties the Tx and Rx lines, so any characters you send are echoed back on the receive side. For a special project, I needed one that tied together two whole bidirectional ports so I could connect a piece of software that wanted to use a serial port with another that emulated responses for testing. Here's the frankencable I came up with a couple of weeks ago.
Requirements
- Be built with only parts on hand (that is, in my toolbox at the office, or things I regularly keep in my car, which has more of the same)
- Consist of two different USB-Serial chip vendors, for easy differentiation with udev rules
- Work out-of-the-box on most 2.6 Linux kernels (so the Keyspan 4-port adapter is automatically out, with the Ubuntu 8.x bug 149649)
- End goal: write data into one usb-serial device and be able to read it out of the other, on the same machine.
This ended up being a pretty quick rummage. The only devices handy were two FTDI TTL232 which are TTL-level, and a bunch of Prolific PL2303-based RS232-level chips. The handy MAX232 does this conversion, but I didn#8217;t have time to prototype a board...
But the RepRap to the rescue. I had one of the old comms boards which had a MAX232 on it, but it would need a computer PSU to provide power, except...
It needs 5v which the FTDI cable can already provide.
A few jumpers, a spare servo cable, and some trial and error (I always forget whose perspective Tx and Rx are from) later, we have this wonderful gadget (where every connection is pretty much wired backwards from intended):