Monday, February 20, 2012

My experience with OpenWRT on TP-LINK WR703N


Just got a TP-LINK WR703N, which is a low cost 3G-wifi router. It comes with a USB host, one LAN port, one WIFI interface, and a mini usb connector for power supply.

It would be a nice choice for hobbyist to hack and do somethings cool with it. For example, may be a WIFI enabled sensor is awesome!


Let's get started!


*** Do at your own risk! May damage your router ****

[Flash OpenWRT]

As it is a new device, I use the firmware upgrade web interface inside (http://192.168.1.1, admin/admin) to flash openwrt firmware:

Download the latest firmware from the openwrt website: http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

Once it is flashed successfully, it will reboot and then you can try to telnet to it.
 
telnet 192.168.1.1
 
root@OpenWrt:/# cat /proc/cpuinfo

system type : Atheros AR9330 rev 1
machine : TP-LINK TL-WR703N v1 processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 265.42
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes,
count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented : mips16
shadow register sets : 1
kscratch registers :
0 core : 0 VCED exceptions : not available VCEI exceptions : not available

[Web Administrative Interface]

Once enabled telnet, you can try connect the LAN port to a router with internet access and it would be able to access the internet.

At this point, assuming you can access the internet in the openwrt telnet console. We are going to install the web GUI for easy configuration:


To retrieve the current list of available packages in the repository do
opkg update
then for a full LuCI installation without HTTPS support enter
opkg install luci
Enable (so that it will be started at every boot) and start uHTTPd:
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start
You should now be able to connect with a web browser to you router : http://192.168.1.1/

(More info on http://wiki.openwrt.org/doc/howto/luci.essentials)

[USB mass storage]
Assuming you still have the internet access, let's fetch in the usb mass storage essentials:

opkg update
opkg install kmod-usb-storage block-mount

Also, you have to install the file system and codepage related modules.
for fat32 (Windows compatible), I installed the following:

opkg install kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 

For other file systems, please check the following document:
http://wiki.openwrt.org/doc/howto/usb.storage

Now, you can mount the usb disk!
mkdir /mnt/usb
mount /dev/sda1 /mnt/usb

[USB to Serial : Silicon Labs CP210x]


The usb driver for cp210x is not available in the pre-complied packages, I have compiled using openwrt build system (based on Kernel 3.2.5), you can download here:
http://androidhk.com/usb2serial.tar.gz

put the *.ko in /tmp
and then
insmod /tmp/usbserial.ko
insmod /tmp/cp210x.ko


Once you attached the usb2serial adapter, the /dev/ttyUSB0 will be ready to use. Now, you can communicate with the MCU.


[References]
Official TLWR703N openwrt page: http://wiki.openwrt.org/toh/tp-link/tl-wr703n

5 comments:

tuwuhs said...

Hi,
I'm having problem with a TL-MR3020 (the hardware looks similar to TL-WR703N, I don't know if it is the same).
When I use USB-to-serial converter with wireless turned on, the serial connection drops at random.
The loopback test (Rx and Tx lines tied together) also fails few seconds after the /dev/ttyUSB0 is opened.
I just want to know, did you tried the USB-to-serial with wireless turned-on on your WR703N?
Thanks.

Bitartist said...

Yes, I tested with wifi on, but not under heavy wireless traffic, I didn't see this problem, but I have similar drop dropping problems when using USB camera. May be you can consider to connect a hub to the router and then connect the usb2serial to the hub. (the hub should have its own power adapter)

tuwuhs said...

That's a good idea, I'll find a powered hub.
I tried with an unpowered hub, it still fails.
I have also tried to use FT232-based converter in self-powered configuration (external powered), also with the same result.
If you don't mind, could you try the loopback test, sending something like "aaaaaaa..." continuously, with the wireless active?

Geeth Nuwan Pathirana said...

helo.

I installed openwrt on my TP-Link WR703N. but now I cannot install LuCI interface on it. is says,

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz.
wget: bad address 'downloads.openwrt.org'
Collected errors:
* opkg_download: Failed to download http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz, wget returned 1.
root@OpenWrt:~# opkg install luci
Unknown package 'luci'.
Collected errors:
* opkg_install_cmd: Cannot install package luci.

I connected my computer to internet using my HSDPA dongle before doing this. but it's not downloading. I ping to some addresses but it also not working. please help me

Bitartist said...

you should make sure your router is online.

I do that by connecting the TPLINK router to my home wireless network.