Introduction: How to Use Serial Console Recovery for OpenWRT

About: I like making things, trying to utilize my hands and my brain. There is no limit!

I have a nice wireless router from TP-LINK, MR 3420. It is a typical WiFi router, the reasons I bought it were:
1. it has an USB port and
2. you can load OpenWRT on it.

So I got the device, I installed OpenWRT and somehow I managed to setup the wrong IPs. The result? I was locked outside - it was impossible to get in, typical 192.168.1.1 was not working neither buttons combinations as described in OpenWRT pages (failsafe mechanism is not working or not available for this router).

I asked also someone to try to "unlock" it, but no success. The last solution was to use the serial console recovery.

A few words about serial console recovery for OpenWRT: technically speaking each router has a serial port. This can be either
located on a connector on the PCBA (printed circuit board assembly - the electronic board with components), either are some separate pads on the PCBA and there some wires must be soldered in order to access the serial port.

Also it worth mentioning that the serial port on such devices is not RS232 serial port: serial port on routers is using electrical signals in the range 0V..+3V3 or 0V..+5V, RS232 is using signals -12V..+12V. So using RS232 to USB converters is not useful, we need a 3V3 or 5V logical level to USB converter.

My friend Google told me that there is a cheap way to build such a converter: use a data cable for mobile phones (some old models). Basically you can pay 5$ and get a nice data cable: at one end you have the phone connector, at the other a USB connector with a small PCBA which converts data to USB.

The purpose of this instructable is to describe how to build such cable for a serial console recovery for OpenWRT on TP-LINK MR4320 and  MOST IMPORTANT how to use it because I made the cable, I connected myself, it was working, but I had no clue how to perform the recovery, I am not familiar with Unix / Linux.

Tools needed:
-soldering tools
-screw drivers
-wire cutter
-cutter
-hot glue gun
-helping hands or a small vice


Materials needed
-hot glue
-data cable for mobile phones (type DKU-5 or CA-42)
-2,54mm header 4 pins (both male and female)
-PC with PuTTY

Let's start! 

Step 1: Cutting the Cable

Buy one USB to serial data cable (logical levels 3,3V or 5V) type DKU-5 or CA42. 
Cut the connector which goes to the mobile phone.
Open the USB plastic case in order to identify the wires: Tx (data transmit FROM computer TO device), Rx (data received FROM device TO computer) and GND.

Therefore Rx from the PCBA must go to serial Tx on the router, Tx from the PCBA must go to serial Rx on the router.
Also identify in advance the pins on the TP-LINK MR3420 router, you need to match the cable, you have to fit them.

Step 2: Soldering Connector on the Cable

As stated in the previous step, it must be identified the serial port location on the PCBA of the TP-LINK MR3420 in order to match the cable connector. Check the image with the serial port location. You can see location of SJ1 connector, a footprint for 2,54mm headers, 4 pins.

Based on that, the 4 pins female header was soldered at the end of the cable, also a 10k Ohm resistor was soldered (pull-up) between Tx of the cable and the GND pin. Hot glue was used to make a stiff assembly.

Since the USB plastic case of the cable was open, 2 solder joints were made on the USB metal case to improve it mechanically and electrically. 

Connections should match the "schematic" presented here.

Step 3: Soldering Header Connector on the Router

In order to connect the cable, a connector is need on the PCBA of the TP-LINK MR3420 router. Since the cable used a header 2,54mm female, on the router I used a 2,54mm male 4 pins header.

It is pretty straight forward the soldering process on the pads of SJ1, after that I checked the connection.

Step 4: Serial Cable and Driver Setup for Windows Operating System

So far so good: a USB cable is connected to the TP-LINK MR3420 router's serial port for serial console recovery.

USB cable goes to your computer, therefore a driver is needed. I have Windows 7 and it was cumbersome to find a driver for the cable. I cannot give a specific driver location on the Internet for download because my driver was not working on another similar cable, so better try finding on your own the driver you need. Sorry!

The cable is a classic USB to serial using PL2303 chipset from Prolific (annoying name - I lost time, it wasn't prolific at all). After finding the right drivers for the cable, the cable was a serial port.

It maybe that the price (5$) put some troubles on my way and maybe the chip was not genuine, who knows? In the end it was working fine.

Step 5: Serial Connection on Windows

Connect the cable to the MR3420 router.
Power the router.
Download PuTTY from the Internet (just google for PuTTY). Open the application and do the setup as in the screen shot.
Hit "Open" button.

Now you should see a black screen, hit Enter key a few times to make sure you have the root prompt. Ignore garbage characters comming out from the high quality cable just made :)

Step 6: Serial Recovery Console in Use

So I am connected to the router. Here was my problem: what to do in order to gain my access rights back? Where to modify? What to modify? I was not able to find a step by step description.Eventually a friend advised me and here I am. 

Since I don't know too much Unix. / Linux, a barbarian method was used in order to regain my access rights: restore to factory defaults. Simple, isn't it? Not too smart, but worked. Write following commands in order to reset to factory defaults:

firstboot && reboot

After that, the router will reboot and you have to use PuTTY again, this time use Telnet to connect to the router to 192.168.1.1 . Give following commands to setup root password (write it somewhere in order to have it in case you forget it, if you don't want to reset again to factory defaults...):

passwd

From this moment on, telnet is not accessible anymore, use PuTTY and SSH or web interface (via Internet browser - see images) to connect to the router, user name is root and password is the one given via telnet and the one you wrote it down. Do you remember it? :)