Building a Serial Port for TL-WR703N

From VillageTelco
Jump to: navigation, search

Author K Williamson

After "bricking" both of my TL-WR703N routers by flashing with "bleeding edge" (r29140 at that time and fail-safe broken), I decided to buy some sort of serial TTL level-shifter so that I could access U-Boot and the OpenWRT console.

I looked at several options but in the end decided to go with the CP2103-based USB to serial TTL adapter from Sparkfun:

I liked the fact that it was USB instead of RS-232 (and thus saved me from having to buy yet another USB to serial adapter), didn't need to have a Vcc reference from the target board to determine the TTL level (the above board is set to 3.3V by default), has drivers available for Linux and Windows (if you're into that sort of thing), and cost only $21.95.

So I went ahead and ordered it and then immediately started work on preparing both of my "bricked" units for it's arrival.

I realized as I worked through the early stages that it might be helpful to others if I did a little write-up with photos of the mini-project. Cheers!


1. Removing the top

Removing the top
The only advice I'd seen on the Internet for opening one of these devices was to use a thin blade screwdriver or knife blade and pry up vigorously. When you don't know how it's attached internally, that's about the best you can do. However, once having opened one up, you can figure out where to pry for best effect (and least cosmetic damage).

On the underside of the lid, are three tangs that engage three sets of teeth on the inside edges of the enclosure base. See top and bottom detail pictures. There is also a single small tooth on a corner of the lid that tucks under one corner of the base that has an extended inside corner.

Having discovered the above, removing the lid of my second bricked unit was much easier.

I recommend first prying the side of the base out and then levering the lid edge upward using a thin, flat screwdriver (wider blade would be best as long as it's very thin). See first location on photo. If the now released edge of the lid seems like it wants to pop back into place, insert a second thin-blade screwdriver in the crack to prevent that from happening.

Now use your thinner screwdriver to pry at the second location noted on the photo. Use the same outward and up prying motion to pop that edge free.

Once those two edges are free, you should be able to carefully pry the entire lid upward and away from the remaining sides and remove the lid without damage.

The circuit board can then be lifted out of the base by lifting the corner opposite of where the reset switch is located and angling the board out so that the RJ45 and micro-USB connectors clear their holes in the base.

Detail of top

Note the location of the three "tangs" that engage the teeth in the inside edges of the enclosure base. Note also the single tooth that engages the extended lip in the enclosure base (just to the right of, and above, the reset hole in the front of the unit).

Other structures to note (but not part of holding the lid to the base) are the light-pipe, a pair of extruded columns that secure the circuit board from above, and what appears to be a fourth tang that functions as a reinforcement extrusion for the micro-USB connector on the circuit board.

Detail of enclosure

Note the three sets of tooth-pairs on the inside top edge of the enclosure base. Also note the extended lip on the lower right corner of the base. Finally, note the sections of what look like fences that the lid seats on.

Other structures to note (though not part of holding the lid to the base), are a pair of extruded plastic alignment pins for the circuit board.

The hole visible in the side was added in the procedure discussed below.

2. Mounting the serial port jack

Drill hole for jack

I decided to use a common chassis-mount stereo headphone jack for the serial connector since it has three conductors, is very compact, and only requires a drilled hole for mounting.

Philmore (LKG Industries) makes one in a nice compact cylindrical body with a slightly smaller diameter (6 mm) threaded end with knurled securing nut. It's model number 504K:

I got it at Fry's Electronics here in the U.S. for $1.87. The matching plug was just $0.99 and is the Philmore 502P (on same pdf above).

I chose the location shown on the photo because it is adjacent to the TP_IN and TP_OUT pads, is clear of the lid attachment points, and has low-profile circuit board components below it. Nevertheless, it's critical to center the needed 6mm diameter hole 5.5mm below the edge of the enclosure base. Any lower and you risk having the outer barrel of the jack touch the components below. Any higher and you risk preventing the lid from fully reseating when you are all done.

In order to have a clear location for the jack, it was necessary to remove one of the "fence" extrusions by shaving it away with a thin, pointed exacto-knife. This opens a section where the hole can be centered between the two adjacent "fence" extrusions.

Once you have that shaved down, I recommend carefully measuring and marking the center of where you will drill the hole. I started by drilling a very tiny hole from the inside and then used a couple of larger drills to step up the size of the hole from the outside until the headphone jack would just push through.

With the hole drilled, reinsert the circuit board and install the jack from the inside then secure tightly with the included knurled nut. As you tighten the nut, make sure that the connector lugs for the jack are positioned conveniently for soldering the connecting wires.

You may be more comfortable pre-soldering the wires to the circuit board while it's removed from the enclosure and then soldering the wires to the jack after reinstalling the board and installing the jack.

3. Wiring the jack

Mount jack
I have to confess that after doing the mechanical prep of the TP unit, I had one of our micro-soldering aces here at work do the circuit board soldering.

I arbitrarily chose to wire the stereo jack tip lug to TP_IN and the other active lug to TP_OUT. It doesn't matter as long as you're consistent when you later create the cable and wire it to the CP2103 adapter. If like me, you have more than one bricked TP to fix, you'll definitely want to wire them the same way so that your cable with stereo plug will work with both units.

You can tack the wires directly to the little pads on the circuit board (both of my units are V1.2) or solder the wires to the end of the components that are at the end of the short circuit board traces that lead to those pads. My soldering guy elected to do the latter.

There is a defined TP_GND pad on the circuit board but it's on the underside of the board so instead we went with one of the existing solder points for the RJ45 shield (see photo). It works just fine.

4. Wiring the cable

Wiring the cable
I made the cable using a CAT5 ethernet cable that was annoying me because of it's broken locking tabs. I chose one wire-pair of the four for TP_IN and TP_OUT, and chose one wire from one other pair for the ground. I snipped all the other wires off at both ends and soldered the one end to the plug (remembering which color would be TP_IN and which would be TP_OUT).

The CAT5 cable I chose worked well because it was a very snug fit though the outer body of the plug which provided ample strain relief.

5. Wiring up to the CP2103 Adapter

When the CP2103 adapter arrived in the mail, it only took a few minutes to solder it to the appropriate holes at the end of the adapter board. Since I knew that the solid green wire in my cable was ultimately connected to TP_IN, I soldered that to the board's TXO, the white/green wire to RXI and my ground wire to GND.

Until I find something more appropriate (maybe), I used a little clear plastic snap-to-close box to mount the adapter in. I filed a rectangular slot in one end just big enough to set the USB connector through, then marked, drilled, and counter-sunk holes in the bottom of the box for a pair of M2.5 flathead screws long enough to put 2mm nylon standoffs on each, followed by the adapter board and then secured the board with a couple of M2.5 NYLOC nuts.

I then filed a "U" shaped slot in the opposite end just large enough to press fit the CAT5 cable into and added additional strain relief with small cable ties around the CAT5 on both the inside and outside of the box.

That's it.

6. Setup and test

My development environment is on a netbook running Ubuntu 10.04. I did a tail of /var/log/messages, plugged the USB adapter into the netbook and was gratified to find that Ubuntu already had the driver support for the CP2103 built-in. The device was recognized and was assigned as TTYUSB0.

I installed minicom, ran "minicom -s" to create the default minicom config file, changed the serial port to TTYUSB0, set it to 115200, N, 8, 1 with software flow-control. I saved the config to "dfl" so that it would always come up that way, reset it, and applied power to the first "bricked" unit. I immediately got the U-Boot boot up output followed by OpenWRT boot up output. I tested a few long "ls -l" commands to ensure that the serial session wouldn't freeze up from buffer overflow but everything worked just fine.

That's all there was to it. Hope this was helpful!



PS..thanks to Elektra for urging me and others to take the time to get serial working. I no longer have to worry about flashing bad firmware! 8^)

Personal tools