Building a Serial Port for TL-WR703N
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
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.
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.
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
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
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
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.
6. Setup and test
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^)