Tp-link router

From Ace Monster Toys Wiki

Revision as of 18:51, 23 January 2012 by Myles (Talk | contribs)
Jump to: navigation, search

Davr recently coordinated a group buy of a bunch of cheesy tp-link TL-WR703N wireless routers.

Here is a picture of the board:

Top of the board
Bottom of the board

(the blue part of the case comes off with a slim piece of metal and a small amount of focused violence).


Wasting Time Reading About OpenWRT

here is a link to an associated thread on it looks like there is a working port of openwrt for the wr703n.

here is a link to a blog post about using openwrt to diddle arduinos attached to the wr703n usb port. i know how you love those arduinos!

Flashing OpenWRT

Want to run OpenWRT? Get the image:

Upload it at

Once flashed, telnet to

For a little more info on how to get the router running, here is an In Depth Setup

If you manage to get OpenWRT on, but somehow lock yourself out (like breaking the firewall, as I did), press the reset button a few seconds after powering on, the blue LED will blink furiously and it will let you telnet in as root with no password.


Once you have OpenWRT running, you can use their pre-built SDK for cross-compiling to the MIPS processor.

Get the SDK at:

You'll need to add the cross-built GCC binaries to your PATH. Something like

export PATH="$HOME/dev/toolchains/tplink/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-$PATH"

To build:

$ mips-openwrt-linux-gcc -static -s hello.c -o hello
$ file hello
hello: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, statically linked, with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, stripped

Autotools cross-compiling

export PATH="$OPENWRT_TOOLCHAIN/usr/bin/:$PATH" 
export ac_cv_func_malloc_0_nonnull=yes
./configure --build=x86_64-linux-gnu --host=mips-openwrt-linux

Blinking the blue LED

# echo 0 > /sys/devices/platform/leds-gpio/leds/tp-link\:blue\:system/brightness
# echo 1 > /sys/devices/platform/leds-gpio/leds/tp-link\:blue\:system/brightness

Sample C program:

Wrecking your Router

According to the internets, console I/O can be had by wiring up to TP_OUT and TP_IN at the edge of the board, closest to the dram part.
The test points pull off of the board very easily so be extra careful if you decide to solder stuff to them or follow Myles's advice and solder to the empty capacitor pads next to the test points.

I used this level shifter to read the output but it doesn't pull down the TP_IN line properly for sending data to the target board.
comm parameters are 115200 baud, N81

Recovering from a bricked router

Set up serial port, then

Set up the tftp server at and connect to bricked box via ethernet.

Break the autoboot on the serial console by typing tpl. It will keep whipping by, just type tpl and it will eventually work.

hornet> tftpboot 0x81000000 openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin hornet> erase 0x9f020000 +0x3c0000 hornet> cp.b 0x81000000 0x9f020000 0x3c0000 hornet> bootm 9f020000

I learned how to do this from mrzaphodb at

Interfacing with Arduino

opkg install  the following
  coreutils-stty - 8.8-1
  kmod-usb-serial -
and your serial port driver, probably
  kmod-usb-serial-cp210x -
  kmod-usb-serial-ftdi -

Script to read from arduino

# simple script to tail newline terminated messages from the arduino
# adjust the head number depending on your arduino messages

if  ! [ -f /tmp/isrunning ]; then
  if  [ -c /dev/ttyUSB0 ]; then
      echo $$ > /tmp/isrunning                   
      /usr/bin/stty -F /dev/ttyUSB0 raw speed 9600    
      while [ 1 ]; do                        
              if [ -c /dev/ttyUSB0 ]; then
                      head -n 3 /dev/ttyUSB0 >/tmp/volts
                      sleep 1         
                      # USB dissapeared. 
                      echo "Arduino no longer attached" >/tmp/volts
                      rm /tmp/isrunning
      echo "Arduino not yet  attached" >/tmp/volts


CGI to view data from arduino

# simple CGI to tail most recent info from an arduino

if ! [ -f /tmp/isrunning ]; then
        /usr/bin/ & 2>&1 >/dev/null

echo "Content-type: text/html"
echo ""
echo "<html><head><meta http-equiv="refresh" content="1">"

echo "<h2>Voltmeter</h2>"
#echo "<font size=4>lame txt and pre to get around android's bouncing status bar</font>" 
echo "<pre>


echo "<h4>A/D reading, volts, degrees</h4>"
echo "<font size=24><pre>"

cat /tmp/volts

echo "</pre></font></html>"
echo ""


Build VM

I set up a Vmware image to make development easier. It didn't actually end up being easier, but now the work is done for you.

Personal tools