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.
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.
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.
- Clean L14 and L15 with a fibreglass pen, then fit shorting links
- Clean the 15K resistor pads R127 and R128 with a fibreglass pen
- Fit the 15K resistors
- Clear holes for & fit the two capacitors (observe the polarity)
- Clear holes for and fit the Xtal
- Drill hole in PCB and mount 7805. Clean pads & solder tygadure flying leads to pads
- Clear holes for and fit the IDC8 connector
- 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
Compiling Kernel
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
Using an X330 without a C2T cable
It is possible to run the IBM X330 server without the C2T cable for keyboard, video and mouse. The X330 supports a PCI video card and it also supports USB keyboard & mouse. Installing a PCI video card is easy enough, the main problem is that legacy USB is disabled by default and without it the USB keyboard won't work. It can be enabled in the BIOS but that entails using the keyboard, which creates a bit of a catch-22. There is a work-around, that is to use the remote console option that the X330 provides through the RS232 serial port to change the BIOS settings. That enables console redirection to a terminal & one can set up the BIOS from that.
A null modem cable is required to connect the X330 to another PC running a terminal program such as Hyperterminal for Windows. Plug the cable into ComA (com1) of the X330. Set up the terminal software for a baud rate of 9600 (or 57,600), no parity, 1 stop bit and no flow control. Start the terminal software and turn the server power on, press Esc on the terminal to bring up the login screen. Log in as USERID and enter PASSW0RD for the password (all upper case, passw0rd with a zero). From the menu that appears select option Z - Start Remote Video. The line “0 - Write or 2 - Read” should appear then, press 0 (zero) to send the command to the service processor on the server & the console redirection should start. From there it's straightforward, when you power up the server the console will show the X330s boot routine on the terminal just like one sees it normally…..just a bit slow & jerky. Press F1 when the prompt comes up to get into the X330 BIOS and navigate the menus to the option that enables legacy USB. Save your changes, reboot when finished & you should have the USB keyboard working.
On the terminal you can Press Ctrl-R + Ctrl-E + Ctrl-T to redisplay the menu from console redirection mode. Esc returns to the main menu from any sub-menu. The server doesn't have to be running to bring up the terminal session, just needs power applied to it. You do of course need to start the server to get anything coming up on the console once console redirection is enabled. If the USERID and PASSW0RD are rejected you're in trouble, because that's the default login & someone would have changed them if they don't work. Double-check your typing & be sure you're using upper case, if it doesn't work then you need to borrow a C2T cable or read the manual for a way of clearing the NVRAM via jumper on the mainboard. If you get garbage on the screen with the terminal try a baud rate of 57,600. When setting up the BIOS it pays to disable boot error counting as well as that resets the BIOS back to defaults if it detects three interrupted boots in a row. (will lose your USB again if it does that).
Home Theatre PC
Well its actually built and I decided that I should get around to documenting what I did. In the meantime here are some pictures of what it looks like.
I was downloading various things onto it so it was convenient to put in next to the hub. I have now wireless enabled the box so it can be happy anywhere.
For the software:
- Windows XP
- Meedio for the HTPC interface
- http://sites.mobile.yahoo.com/go/tv/index - YAHOO now owns meedio
- streamzap remote to control everything
- Media Player Classic (included in XP codec pack)
- Cyberlink Power DVD as it supports the VIA mpeg hardware accelerator.
- Quicktime Alternative Codec
- XP Codec Pack to play all major audio and video formats
dh10p - Ethernet of power line adapter
My Ethernet powerline modules turned up yesterday so I set about playing with them.
They are model DH10P_9010 made by a company called Comtrend however if you look up the first 6 digits of the mac address 001396 you'll see that the manufacturer is really AcBel.
A quick search of AcBel's website reveals the device. So it looks like Comtrend who use to manufacturer their own device has decided that simply flogging off other peoples is more profitable under the code DH-10PF.
I currently have one located in the room with my WAN feed and Router, the other is free roaming around the house. The speed down these is pretty good I get ~100Mbps from this 200Mbps device which is as good as you could expect. Depending upon the power cable ring I choose it can vary by up to 20Mbps. I suspect the throughput of 200Mbps is a half duplex rating so at Full Duplex you get 100Mbps - cheeky marketing sods.
It uses the Spanning_tree_protocol to create an 802.1d bridge. One unit needs to be designed the Root Bridge (master) it's doesn't matter which device has this role. The Amber AP light will be lit on this unit.
If you cable one directly to your PC and run WIRESHARK you'll see what happens when they start up. They send out STP (Spanning Tree Protocol) and DHCP DISCOVER packets, this means that the one attached to the DHCP server will get its IP address first and becoming the master Access Point.
Once all the device have been allocated an IP address examine your DHCP server and see what IP addresses got farmed. Point your browser at one of them to access the devices WEB management interface. The default web access password is admin
I bought these off ebay so I see they are BT supplied units. Interesting to note it's only the firmware that has been branded from the outside there is no BT logo at all.
The firmware version is: spirit_dh10pf_9010 s2_2_9-BT-V3.3_cvs
Perle - Serial terminal servers
RJ45 to Sun server Netra PORT RJ45
Perle Sun | RJ 45 RJ45 RJ45 | Sun Pin Pin | 1 (DCD) Green White n/c | 1 Blue 2 (DSR) Green --- 7 DSR | 2 Orange White 3 (DTR) Orange White --- 2 DTR | 3 Brown 4 (GND) Orange --------- 4 GND | 4 Orange 5 (TXD) Brown White ---- 6 RXD | 5 n/c 6 (RXD) Brown ---------- 3 TXD | 6 Brown White 7 (CTS) Blue White ----- 8 CTS | 7 Green 8 (RTS) Blue ----------- 1 RTS | 8 Blue White
CS9000/JETSTREAM CONVRT RJ45 DB25 CONVRT TO SUN Part #: 04024520
CS9000/JETSTREAM Cable 3M RJ45 SUN/CISCO To Perle For Sun Part #: 04024500
RJ45 serial port wiring info for Perle here
Perle console bootup output
This is the output from attaching a serial cable to the ADMIN port and powering on the unit. Hyperterminal set to 9600,8,N, 1
At the login prompt try Username 'admin' with no password.
Board id : 4300085R3.1 ROM size : 1 x 1MB RAM size : 2 x 2MB Num ports : 8 Diag codes : 01 03 04 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 08 09 0A 0A 0B 0C 14 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 16 18 19 ÏÙÏÙ1B 1C 1E 33 35 2B 25 26 28 27 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 6A 6B 2C 32 37 3A 46 48 92 93 94 95 Decompressing - ................................................................ ................................................................................ .........................................done B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB INIT: booting... INIT: parallel ports found: 1 INIT: serial ports found: 8 Time: 16:34:23 Date: 19/06/2007 File sytem has 30 blocks, 30 are free INIT: TCP stack initialised Perle JETSTREAM 4000 Version 2.6.1.G login: admin password: JS_4000# show hardware mac address 0080ba601d9a board id JS4300085R3.1 processor 80386 uarts 1 * Serial ASIC flash rom 1 x 1MB ram 2 x 2MB battery ram 32kB serial ports 8 parallel ports 1 ethernet interface RJ45 ethernet speed auto date 19/6/2007 time 16:38:05 JS_4000#
These images are for Board revision: 4300085R3.1
Click for a full 1600×1200 resolution image
Broken Perle Bootup
Bootup dump from Admin (RS232) port : Board id : 4300085R1.0 ROM size : 1 x 1MB RAM size : 2 x 2MB Num ports : 8 Diag codes : 01 03 04 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 08 09 0A 0A 0B 0C 14 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 16 18 ÏÙÏÙ1B 1C 1E 33 35 2B 36
Note: The Diag codes above contains a couple of 'unprintable' chars. The unit always seems to freeze after printing the '36' with the Power LED at solid amber and no other lights visible. Pressing the 'factory reset' button does nothing (held in for 5 secs).
Trueport
Trueport drivers install on Windows and create 'virtual' comm ports on the Perle box.
To allow the Trueport drivers to connect to the Perle box, some commands must be run on the Perle box.
First, the details of the host that will connect need to be specified … e.g. 'add host hostname 192.168.11.1'
Then each port that is to be used needs to be configured …
e.g. 'set line 1 service silent raw hostname 10000'
Hookup to a temperature sensor
Thinking of hooking up a DS1820 temperature kit via the Perle box. This kit looks good. However, it seems to source its power directly from the RS232 port. Can the Perle box supply sufficient current? Can't find anything in the Perle documentation re the hardware specs for the ports.
Links
DB9 female to RJ45 female adaptors - http://www.microwarehouse.co.uk/catalogue/item/STARAD17?cidp=NexTag&utm-source=nextag&utm_medium=pcc