blog:sweex_router_hacking

Sweex Router Hacking

This details our work with the Sweex LB000021 router. Hardware mods to allow an external USB pen to be fitted and the firmware to allow Linux to boot from this.

sweexrouter.jpg

The unit has 2Mb of Flash ROM, a whopping 16Mb of RAM and 5 RJ45 ports. There is a (TTL level, with no external connector) serial port and a bootstrap loader that allows images to be loaded to the flash ROM via the XModem protocol.

This router is also rebadged as an Edimax BR6104k.

Interesting to note that the Linux still booted correctly when a USB hub was plugged into the router and the USB pen was plugged into the hub. The OS on the router spotted the hub and installed it. This gives a possible route to adding extra I/O to the router.

Wiring / Hardware hack notes

Adding the USB port is a tricky job. The PCB on the router uses surface mount parts, and soldering to the empty pads is not easy. A good tip is to use a fibreglass pen to clean each pad before attempting to solder. A desoldering station can be used to clear out the PTHs for the Xtal, Caps and IDC8 connector.

Rewiring details and pics can be seen here.

Here is a suggested order of wiring.

  1. Clean L14 and L15 with a fibreglass pen, then fit shorting links
  2. Clean the 15K resistor pads R127 and R128 with a fibreglass pen
  3. Fit the 15K resistors
  4. Clear holes for & fit the two capacitors (observe the polarity)
  5. Clear holes for and fit the Xtal
  6. Drill hole in PCB and mount 7805. Clean pads & solder tygadure flying leads to pads
  7. Clear holes for and fit the IDC8 connector
  8. Prepare wires for the USB lead and solder to pads

Working from the edge of the board in, the USB cable colours are red,white,green,black. Fit the 22R resistors in series with the USB data lines inside the USB hub.

Pinouts

JP2

2 4 6 8
+3v3 n/c n/c Gnd
RxD n/c n/c TxD
1 3 5 7

ADM5120 routers has a serial/console port. On the PCB of the router there is a 8 pin connector called jp2. Here are the pins located for a serial console port (115 kBaud, 8 databits, no parity, 1 stopbit)

http://midge.vlad.org.ua/wiki/console_cable?DokuWiki=7894a2f2ce8c46fc6141ba03cbaa3e04

jp2
2-o o o o-8
1-o o o o-7

1 - Rx
2 - +3.3V
3 - nc
4 - nc (hardware hack: connect to pin #130 ADM5120 - Rx second UART)
5 - nc (hardware hack: connect to pin #131 ADM5120 - Tx second UART)
6 - nc
7 - Tx
8 - Gnd

Handy online resources

http://www.linux-mips.org/wiki/Adm5120 - ADM5120 Chip info
http://sprite.student.utwente.nl/~jeroen/projects/lb000021/usb_tutorial/ - Adding the USB parts tutorial
http://vlad.org.ua/adm5120/ - Russian site with lots of info
http://www.norocketscience.com/router/upgrade.htm - Details of the firmware headers etc.

Copied from Google cache of a blog … kernel hack for bridge operation sweex_bridge.rtf

Digital I/O expansion unit

Since the hacked Sweex exposes an RS232 port, it seemed logical to add some I/O expansion capability. A little AVR microcontroller board, with a simple command interpreter can do the job. Since the hacked router uses a Max232, we need another Max232 to bring the levels back down to TTL again. So, the expansion board will have an AVR 2313, a Max232 connectors for I/O pins and RS232. Power can be leeched from the 7805 on the hacked Sweex.

A few lines of Bascom will implement the command interpreter.

Dioioioio - set port directions (i)nput or (o)utput
R - read port bits returning 01010101
W01010101 - write port bits

Cybiko Gateway aka CyWig

Using Greg Smiths TCPKIT port the PC based portion of this project the TCPGATE software to the sweex box this would recreate the functionality that the CyWig was suppose to perform.

A cybiko permenently wired to the Sweex RS232 port would act as an IP gateway so that any cybiko in range could access the internet or anything IP based.

Booting

Boot sequence from Sweex box

ADM5120 Boot:

Linux Loader Menu
====================
(a) Download vmlinuz to flash ...
(b) Download vmlinuz to sdram (for debug) ...
(c) Exit

Please enter your key :

Pressing the space bar three times will jump to the linux loader menu and not automatically boot the device.

Upgrade of the flash using option **a*

Linux Loader Menu
====================
(a) Download vmlinuz to flash ...
(b) Download vmlinuz to sdram (for debug) ...
(c) Exit

Please enter your key : a
Downloading.........PASS

Eraseing nor flash.......PASS

Programming nor flash...PASS

If you compile the kernel with the -mip3 flag on gcc the kernel will fail to boot.

linux-lanner/arch/mips/Makefile:

ifdef CONFIG_CPU_MIPS32
# BME
#GCCFLAGS       += -march=r4600 -mips3 -Wa,--trap
GCCFLAGS        += -march=r4600 -mips2 -Wa,--trap
endif
  • blog/sweex_router_hacking.txt
  • Last modified: 2010/06/16 16:27
  • by 127.0.0.1