Davr recently coordinated a group buy of a bunch of cheesy tp-link TL-WR703N wireless routers.
Here is a picture 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 a blog post about using openwrt to diddle arduinos attached to the wr703n usb port. i know how you love those arduinos!
Want to run OpenWRT? Get the image: http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
Upload it at http://192.168.1.1/userRpm/SoftwareUpgradeRpm.htm
Once flashed, telnet to 192.168.1.1
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: http://downloads.openwrt.org/backfire/10.03.1/ar71xx/
You'll need to add the cross-built GCC binaries to your PATH. Something like
$ 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
OPENWRT_SDK="$HOME/dev/toolchains/openwrt" OPENWRT_TOOLCHAIN="$OPENWRT_SDK/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1" export PATH="$OPENWRT_TOOLCHAIN/usr/bin/:$PATH" export LDFLAGS="-L$OPENWRT_TOOLCHAIN/usr/lib -L$OPENWRT_TOOLCHAIN/lib -Wl,-rpath- link=$OPENWRT_TOOLCHAIN/lib/" export ac_cv_func_malloc_0_nonnull=yes
./configure --build=x86_64-linux-gnu --host=mips-openwrt-linux
# 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: https://gist.github.com/1576363/
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 192.168.1.100 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 https://forum.openwrt.org/viewtopic.php?pid=154450
Interfacing with Arduino
Prereqs opkg install the following
coreutils-stty - 8.8-1 kmod-usb-serial - 126.96.36.199-1
and your serial port driver, probably kmod-usb-serial-cp210x - 188.8.131.52-1 kmod-usb-serial-ftdi - 184.108.40.206-1
Script to read from arduino
#!/bin/sh #/usr/bin/readuino.sh # 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 else # USB dissapeared. echo "Arduino no longer attached" >/tmp/volts rm /tmp/isrunning exit fi done else echo "Arduino not yet attached" >/tmp/volts fi fi
CGI to view data from arduino
#!/bin/sh #!/www/cgi-bin/volts # simple CGI to tail most recent info from an arduino if ! [ -f /tmp/isrunning ]; then /usr/bin/readuino.sh & 2>&1 >/dev/null fi 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> </pre>" echo "<h4>A/D reading, volts, degrees</h4>" echo "<font size=24><pre>" cat /tmp/volts echo "</pre></font></html>" echo ""
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.