Thursday, October 31, 2013

Unbricking my Linksys wrtu54g-tm from bad OpenWRT update (only $5 to fix)

About a month ago, I decided to update my WRTUG54-TM router to the latest version of OpenWRT (attitude adjustment) and for the first time I decided to check the box on the Lua Web interface to save my current settings ... big mistake. For some reason, that messed up the update process (I have done this successfully at least 4 or 5 times in the past, so I know what I'm doing). After bricking my router, the first thing that I had to do is figure out how to unbrick it without any special hardware. The first solution is to try setting up a TFTP server on your machine and connect your laptop (or PC) to the router at the blue Internet port. Then set your laptop (or PC) ip address to 192.168.0.250, put the OpenWRT image as "vmlinuz-8668" and run reboot your router. Your router is supposed to automatically use a TFTP client to download the new image and update your router. This is explained here (http://wiki.openwrt.org/doc/howto/generic.flashing.tftp). Sadly, this automatic TFTP update with no user input is not possible on this router because it did not work. Also, this was confirmed by this blog post (http://wiki.scottn.us/wrtu54g-tm:uboot). The only way to trigger this update is to connect to the router via the serial port and manually trigger this using the "run update_kernel" command. Therefore, I had to figure out how to do this. It turns out to be much easier to fix, once you know what to do ... naturally. Basically, you need to buy a USB to TTL converter, here is the one that I found on Ebay (only costs about $5). You can find one by searching for "USB To RS232 TTL PL2303HX Cable Adapter" 

http://www.ebay.com/itm/321168200507?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649.

Another option mentioned is to use a Nokia C42 clone cable, but that requires soldering, plus it costs about the same price. So don't buy that one, it's not worth the struggle.

Now that you have your USB to RS232 TTL adapter, you need to open up your router. There are four screws located under each of the black rubber pegs of the router. They are glued on, just use your nails to pull them off and then you will see the screw drivers. Unscrew and open the router. Once you have the router open, carefully inspect it and you will find 4 pins with the word JP2 next to it. Once you find that, you need to figure out which pins to connect your adapter to. The pin with the triangle next to it is the VDC pin and that is going to match your red wire. The fourth pin is the ground pin, which connects to the black wire. The middle two pins for TXD and RXD, you can play around with that until you get the right configuration. It won't mess up your router. It took me many tries to get it right. But for me, I connected the white wire to the second pin (under the VDC pin) and the green was after that.

Now that you have your pins connected, you can connect to a USB port, also, you do not have to power your router to the wall plug, the USB adapter will power your router. When you plug into the USB, you will see many flagging green lights, then just one flashing green light, that means that your router is powered.

Now it's time to connect to your serial port from your computer. I use Linux and therefore I can accomplish this with the screen command line tool. But Windows users should be able to connect with Putty. Here is the screen command that I used to connect to the router via serial

sudo screen /dev/ttyUSB0 115200,cs8

The "115200" number is the baud rate which is very important to get right. I spent at least 30 minutes trying to figure this out. If you don't see anything when you do this, try unplugging your usb adapter which will cause screen to exit. Then plug it back in and run the screen command 1 or 2 seconds after you plug in the USB adapter. You should see a bunch of output and a command prompt. Now that you have the command prompt, you can do the TFTP update by running a TFTP server on your laptop or PC, put the updated image in the tftp root directory as "vmlinuz-8668" and use ifconfig to set the IP address to 192.168.0.250. Connect the ethernet cable from your laptop or PC to the blue Internet port in your router. Then type "run update_kernel" and wait. The command prompt will let you know when it's done. Then you can just restart by unplugging your USB adapter.

Well this is probably my longest post. But as always, I hope this helps someone else save some time. I would not have figured it out it is was not for this blog that I found about a year ago (http://wiki.scottn.us/wrtu54g-tm).

1 comment:

  1. Great post with lots of technical stuff. If you need any guidence for Linsys router than Linksys Router Support Number open for you.

    ReplyDelete