WRT54GL MAX232 Serial

From DD-WRT Wiki

Revision as of 15:31, 15 February 2008 by RenRenRen (Talk | contribs)
Jump to: navigation, search


Serial port on a Linksys WRT45G/GL router using a MAX232 interface IC

This brief tutorial describes how to add two standard RS-232 serial ports to a Linksys WRT54GL router; the same is applicable to several other models based on the same hardware (WRT54G line et all). The MAX232 is a level converter IC for serial communications which is cheap and available pretty much anywhere.

Technical overview

Most routers of the WRT54G line include two serial ports, complete with pinholes on the circuit board. These operate at 3.3v (TTL) level, so they need a level converter in order to work with a regular RS-232 serial port. This is normally done with a level converter IC, and of all available, MAX232 is the most popular. The problem is that this IC requires at least 4v in order to work properly, and the pin header provides 3.3v.

A solution proposed in several sites is to use a compatible device which allows operation at 3.3v (MAX3232, MAX233), but this are normally more expensive and (most important) difficult to find in several parts of the world. This document describes a workaround which allows us to power a MAX232 with 5v within the circuit board, which allows the use of this IC and provides excellent performance. Since the MAX232 detects a signal level change at around 2v and we're providing 3.3v signals, it works flawlessly.


What we'll do is basically to take power directly from the power connector and convert it to 5vdc. The serial pinout arrangement allows to do this without the need for an additional cable over the board, but this is NOT RECOMMENDED, as it involves soldering a power wire (directly from the wall adapter!) into the serial header. It can be done, but if you don't feel comfortable doing this I'd recommend soldering a wire and taking power directly from it instead through the serial header.

The voltage conversion is done using a 78L05 5vdc voltage regulator, which is cheap, small and does the job nicely. I considered using a simple zenner regulator, but from what I've seen the wall adapter voltage varies wildly between models and even regions, so the 78L05 regulator will do a much better work here.

The first step is to solder a pin header to the serial pinholes on the board - this will allow us to work easier and without further soldering on the board. The detailed pinout is for a Linksys WRT54GL / WRT54G v4; the pinout for other models is similar, but you'll need to check them out.


(Ignore the black wire there - it's from a SD/MMC mod on the same router)

Now, you need to locate the power input on the board and solder a wire to it - this can be done directly on the underside of the board:


We'll be using this wire to power our adapter board. What i did here was connecting this wire directly to the two unused pins on the serial header, in order to keep a tidier wiring. AGAIN: DON'T DO THIS IF YOU'RE NOT COMPLETELY CONFIDENT OF YOUR SOLDERING SKILLS - the unused pins lie between ground and the Rx serial inputs. This means that a bad solder can either fry your serial ports, your power adapter, or the router entirely. Just taking this wire directly to the adapter board will work just as well, even if it's a bit messier.



(Again, that rogue connector is for the MMC/SD socket. Disregard).

This wire/pin will provide with at least 9vdc which we can use to power the MAX232 IC. The adapter schematic is rather simple, and as follows:

The pinouts for serial port 1 (female DB9) and serial port 2 (male DB9) can be found on the web. VCC is the wire/pin we just added/modified. All caps should be rated for 50v (they're small at those capacitances), and the regulator is, as mentioned, a 78L05. A regular 7805 will work just as fine, but it's much bigger and might present issues due to the low power draw of the MAX232.

I built mine on a small perfboard which plugs into the pin header and goes to an old PS2 board plug which i inserted in the back panel. Then i built a cable which provides the two regular DB9 serial connectors (if you're missing two caps, they're on the underside).


Serial port 1 provides kernel messages during bootup and a console, so it can be used for testing. Set your serial port config to 115200, 8 bits, no parity, 1 stop bit (8N1), reboot your router and you should get something like:

CPU type 0x29008: 200MHz
Total memory: 16384 KBytes

Total memory used by CFE:  0x80300000 - 0x803A39C0 (670144)
Initialized Data:          0x803398D0 - 0x8033BFE0 (10000)
BSS Area:                  0x8033BFE0 - 0x8033D9C0 (6624)
Local Heap:                0x8033D9C0 - 0x803A19C0 (409600)
Stack Area:                0x803A19C0 - 0x803A39C0 (8192)
Text (code) segment:       0x80300000 - 0x803398D0 (235728)
Boot area (physical):      0x003A4000 - 0x003E4000
Relocation Factor:         I:00000000 - D:00000000

Boot version: v3.7
The boot is CFE

mac_init(): Find mac [00:1C:10:34:40:40] in location 0

eou_key_init(): Find key pair in location 0
The eou device id is same
The eou public key is same
The eou private key is same
Device eth0:  hwaddr 00-1C-10-34-40-40, ipaddr, mask
        gateway not set, nameserver not set
Reading :: Failed.: Timeout occured
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)

The circuit is pretty straightforward - if you have any issues, check first the output voltage of the regulator and the pinouts for both the IC and the serial Rxs and Txs. Good luck!


Of course, i cannot be held responsible for damages which result from carrying out this procedure. It worked for me, but you are completely on your own if you decide to do it. And needless to say, this mod WILL void your product warranty.