把ROS 安装到Linksys Wireless-G 路由器上
首先来点背景资料Linksys 在2003 年发行的这款无线路由器使用802.11g 标准使得带宽在理论上能够达到54M(2003年的时候),相对于当时业界普遍使用802.11b 的11M 带宽,不能不说实现了一次飞跃。它可以通过自带的DSL / Cable 接口接入宽带互联网,对于内网则支持4 个以太口交换与无线广播接入。2005 年初国内开始销售这款路由器。国外销售价格大概为$60,相对于其他产品来说的话就跟摆地摊的货差不多了。好了,我不是像跟你谈这些参数的问题。关键是:同年有好事者在 Linux Kernel Mailing List 搜索 WRT54G,发现它的Firmware是基于Linux,然而Linux 基于GPL 发布许可证,就是 GNU General Public License. 该许可证规定Cisco 应该把WRT54G 的Firmware 的源代码公开。本来Cisco 拒绝公开源代码,最后,03 年三月份的时候,基于公众压力Linksys 公开了WRT54G 的源代码。故事本来到这里就结束了,然而相反,结果越闹越大:有了源代码以后,开发者便清楚知道代码如何控制路由器的硬件,并且掌握了一些通过增加新的代码到原有的IOS 当中去 ?? 使得硬件支持更多的Feature 的技术。这些开发者组成了一个项目开发团队,不断对原来的IOS 进行更新,编码,加入新的特性…… 现在他们手上的WRT54G 无线路由器的能力已经大大超过了原来Cisco 设计的地摊货的设计思路。不但如此,随着这两年互联网Web2.0 技术的发展,不同的开发团队之间找到了更好的协同工作平台,其规模不亚于TAC. 他们最近建立了一个DD-WRT 项目的Wiki 站点将全套文档以及代码公开发布。使用DD-WRT 项目提供的源代码,重新升级WRT54G 以后你就能够获得一台相当于$600 左右的中端无线路由器了。支持的特征集包括:
http://static.flickr.com/60/162198450_97ce7a5472.jpg?v=0
13 languages
802.1x (EAP (Extensible Authentication Protocol) encapsulation over LANs)
Access Restrictions
Adhoc Mode
Afterburner
Client Isolation Mode
Client Mode (supports multiple connected clients)
Client Mode WPA
DHCP Forwarder (udhcp (http://udhcp.busybox.net/))
DHCP Server (udhcp (http://udhcp.busybox.net/) or Dnsmasq (http://thekelleys.org.uk/dnsmasq/doc.html))
DNS forwarder (Dnsmasq (http://thekelleys.org.uk/dnsmasq/doc.html))
DMZ
Dynamic DNS (DynDNS (http://www.DynDNS.org/), TZO (http://www.TZO.com/), ZoneEdit (http://www.ZoneEdit.com/))
Hotspot Portal (Sputnik Agent (http://www.sputnik.com) ,Chillispot (http://www.chillispot.org/))
IPv6 Support
JFFS2 (http://sourceware.org/jffs2/)
MMC/SD Card Support
NTP client in a client-server basis
Port Triggering
Port Forwarding (max. 30 entries)
QoS Bandwidth Management (Optimize for Gaming and Services / Netmask / MAC / Ethernet Port Priority)
QoS L7 Packet Classifier l7-filter (http://l7-filter.sourceforge.net/))
PPTP VPN Server & Client
Ntop Remote Statistic
Syslog to remote server
RFlow/MACupd
Routing: Static entries and Gateway, BGP, OSPF & RIP2 via (BIRD (http://bird.network.cz/))
Samba FS Automount
Rx/Tx Antenna (Select or Auto)
Show Status of Wireless Clients and WDS with System Uptime/Processor Utilization
Site Survey
SNMP
SSH server & client (dropbear (http://matt.ucc.asn.au/dropbear/dropbear.html))
Startup, Firewall, and Shutdown scripts (startup script (http://wrt-wiki.bsr-clan.de/index.php?title=Startup_Scripts))
Static DHCP Assignment
Style (Changeable GUI; v.23)
Supports New Devices (WRT54G V3, V3.1, V4, V5 and WRT54GS V2.1, V3, V4)
Telnet server & client
Transmit Power Adjustment (0-251mW, default is 28mW, 100mW is safe)
UPnP
VLAN
Wake On Lan client (WOL (http://ahh.sourceforge.net/wol/))
WDS Connection Watchdog
WDS Repeater Mode
Wireless MAC Addresses Cloning
Wireless MAC filter
WMM (Wi-Fi MultiMedia QoS)
WPA over WDS
WPA/TKIP with AES
WPA2
Xbox Kaid (Kai Engine (http://www.teamxlink.co.uk/))
我们在看看 LinksysWRT54G 的CPU 和内存信息
CPU: BCM5352 rev 0 at 200 MHz
Using 100.000 MHz high precision timer.
Calibrating delay loop... 199.47 BogoMIPS
Memory: 14268k/16384k available (1412k kernel code, 2116k reserved, 100k data, 80k init, 0k highmem)
是MIPS 的CPU ,也就是和ROUTEROS的ROUTERBOARD 的CPU 是一样的,那就意味着很可能ROS 的另外一个发行版本可以运行在WRT54G 上,而WRT54G 现在的价格就在300 左右 在 WRT54G可以加 SD 卡增加空间 ,可以直接接显示器 、加串口、加LCD、甚至可以接音箱
先来份 SD 卡图纸
While trying to mod my WRT54G v4 with an SD card, I could not locate GPIO 5 which is needed for data input. After weeks of searching for GPIO 5 using the GPIO Utility, I decided to use GPIO 2 instead. Here is my pinout:
(接线图)
SD WRT54G v4
1 CS GPIO7 DMZ LED
2 DI GPIO2 White LED
3 VSS GND JP2 (9)
4 VDD PWR (3.3v) JP2 (1)
5 CLK GPIO3 Amber LED
6 VSS2 GND JP2 (10)
7 DO GPIO4 Cisco SW
http://support.warwick.net/~ryan/wrt54g-v4/HPIM3879.JPG
http://support.warwick.net/~ryan/wrt54g-v4/HPIM3881.JPG
http://support.warwick.net/~ryan/wrt54g-v4/HPIM3882.JPG
Then I had to compile the MMC Driver after modifying the following GPIO options:
#define SD_DI (1 v1.1版的有改造图吗 Why Add A Serial Port?
Adding a serial port will allow you to:
Access RedBoot, the boot-loader - though you can also TelnetIntoRedBoot.
View kernel messages while the NSLU2 is booting.
Log in, if a getty is running on the serial port, which it normally is.
See any kernel panics.
Interface to peripherals with RS232 ports - though a better alternative for this is normally to use one of the NSLU2's USB ports and a USB2Serial cable.
Pinout of the J2 serial port
Pin 1 3.3V (pin 1 has a white stripe next to it)
Pin 2 RXD (from serial terminal program to NSLU2)
Pin 3 TXD (from NSLU2 to serial terminal program)
Pin 4 GND
Pin 1 is the left-hand pin.
NB: In the photo above, a set of header pins has been attached to J2. As sold, J2 consists only of a row of holes, filled with solder. First action for any of the methods below is to mount such a header (you didn't consider soldering your cable directly to the board, did you?). After that construct a cable to connect to this header using one of the methods below. As an easy starter one can cut a CDROM audio cable in two. That will give you a four pin connector with some wire to connect to. Alternately a flat cabel header can be used.
By default, both RedBoot and the Linux kernel use 115200,8,N,1 settings.
Set DTR drop time to 0, and "modem has DCD line" to no.
Make sure that your terminal program does not send a modem init string and that you have set it to software flow control, not hardware.
RS232 connection without a kit
If you wish to construct a level converter from scratch and not buy a kit then a suitable level converter chip is the MAX3232 from Maxim/Dallas Semiconductor. In addition to the MAX3232, you will need 4x 0.1μF capacitors. The diagram to wire up the capacitors to the MAX3232 is available on the Maxim/Dallas Semiconductor page. You can safely omit the capacitor between Vcc and GND.
Like here:
RS232 connection with a kit
If you wish to buy a kit then the CompSys A232DBH3v Max232 adapter kit (3V version) has been used with no problems. See Rod Whitby's guide for more details.
Another board that works is this one, from Italy: http://www.picbasic.it/interfacce/page2.html . The lead has the right pinout for the NSLU2 connector.
The Siemens S/C25, S/C/M35 and S/SL/ME/M45 phones all operate at 3.3V and the RS232 data cables are compatible. This cable is used on another embedded project. Take a look at: http://www.meshcube.org/meshwiki/ModifiedMobileSerCable
The cable should be powered from the DSub-side (PC/Terminal). The pins which are used are 1 (GND), 5(TX), 6(RX). The Siemens-Handy-connector is shown at http://www.hardwarebook.net/connector/cellular/siemens_c25_s25.html
If your cable is not powered from the DSub-side you have to connect pin 4 to J2 pin 1 (+3.3V).
For a noname cable for Siemens labeled "880880-84501" "A801-2" "Made in China", the BLACK wire is GND, the RED wire is needed for power, the YELLOW cable is data out (TX) and the GREEN cable is data in (RX)
You can also use Nokia DLR-3P data cable. Just cut off connector and wire RED to J2 pin 1 (+3.3V), GREEN to J2 pin 2 (RXD), GRAY to J2 pin 3 (TXD) and BLACK+SHIELD to J2 pin 4 (GND). Since this cable is normally powered by phone you need to connect J2 pin 1.
The Nokia DLR-3 cable is the same hardware, but older Windows95 driver software (which you don't need). I found my cable through Froogle for $2.00 US, so it's gotta be the cheapest serial mod on this page!
USB connection
A USB based data cable for a mobile phone is another possibility. Most (if not all) of these cables are nothing more than an USB to serial port adapter, and as most mobile phone today are using 3.3V anyway they already have the right signal levels.
Most of the cheap cables are based on a Prolific PL2303 chipset (PL2303 datasheet ) which is supported under Windows (Driver Download) and Linux. A third party Nokia data cable for a 8000 series phone has been used with no problems. A data cables from the Siemens C25/35/45 works too. The cables from the old models (i.e. C25) costs a 2..3$.
A cheap($20) cable can be purchased at Radio Shack. The Future-Dial cables have a "dongle" in the middle that has the Prolific usb-serial chip.
See this hack-treo page.
Compatible Radio Shack (Future Dial) "Mobile Phone Data Cables":
- LG Models 1200, VI5225, VX4500, VX4600, VX600
- Audiovox Models 8200, 8500 and 8600
- Nokia Models 3285 and 5185
- Cable 22 (For Nokia 3100, 3200, 3585i, 3588 and others with Nokia 14-pin pop-port)
Installation of "Radio Shack Mobile Phone Data Cable for Nokia Models 3285 and 5185.", "Radio Shack Mobile Phone Data Cable for Audiovox Models 8200, 8500 and 8600.", "MobileAction MA-8710C for Siemens mobiles" and "Future Dial Cable 22"
Open the connector that connects to the cell phone, You only need 3 wires, and these connect to J2.
Below are a number of cables listed with a description of the colored wires that you need. Since clone cables might use different colors I recommend googling for the connector layout of the mobile phone you used and carefully pry the cable open (at the phone connector) and study the pinning/cabling.
For Nokia 3285 and 5185 Cable:
Pin 1 - NC
Pin 2 - Orange
Pin 3 - Red
Pin 4 - Brown/Shield
For Audiovox 8200, 8500 and 8600 Cable:
Pin 1 - NC
Pin 2 - Yellow
Pin 3 - Orange
Pin 4 - Shield
For LG 1200 Cable:
Pin 1 - NC
Pin 2 - Red
Pin 3 - Orange
Pin 4 - Shield
For Siemens MobileAction MA-8710C Cable:
Pin 1 - NC
Pin 2 - Red
Pin 3 - Black
Pin 4 - Shield
For Future Dial Cable 22:
Pin 1 - NC
Pin 2 - Orange
Pin 3 - White
Pin 4 - Green & Shield (twisted together)
For Nokia DKU-5 (WT048000317):
This cable seems easier to get in Australia (I got mine off eBay.) There are generic versions available, so the colours might be different. You will probably need a multimeter to find the correct wires.
From the USB/PC point of view:
GND: White (maybe also Yellow)
TX: Red
RX: Blue (apparently not Green)
You can check these with a multimeter - the voltage between GND and TX is 3.3V, and the voltage sags slightly if you send a lot of data out over the port (e.g. by holding a key down in a terminal emulator.) You can also hook up a speaker between these two wires and it should click whenever you transmit a character/press a key.
The voltage between GND and RX is about 2.5V. If you connect TX and RX together (join the Red and Blue wires) you should see anything you type echoed back to the screen (possibly appearing twice if you have local-echo enabled in your terminal emulator.) For me, this worked when I connected Red to either Blue or Green, but only Blue worked when connected to the WRT54G - nothing was received through the Green wire.
Assuming your colours are the same as mine, then:
Pin 1 - NC
Pin 2 - Red
Pin 3 - Blue
Pin 4 - White
Solder three wires from a ribbon cable to J2. On the cell phone cable, cut off all but the three wires above.
Carve a slot just below the power connector hole in the back panel that will allow you to insert the strain relief through the power supply hole and slip it down into place.
Run the cable through the power supply hole, and solder the other ends of the 3 wires to the phone data cable. You can shrink wrap, or tape the wires.
Slide the strain relief down into the slot, and slide the board back into the case. The power supply socket will lock the strain relief in place.
Plug the USB connector into your Linux box. Start minicom and set the port to /dev/ttyUSB0 115200 8N1. Power up and you will see a '+' printed. Ctrl+C will get a RedBoot prompt, or leave it alone and watch it boot.
Windows users will need a Windows driver for the Prolific USB-to-Serial adaptor, available at the Prolific Technology Inc Support Site
Accessing the terminal
The NSLU2 configure his serial port at 115200 bauds, with 8 bits of data, no parity (8N1) If you run a linux a box, you can use the UUCP for talking to the nslu2 by the serial port:
cu -l /dev/ttyS0 -s 115200 (for COM1).
If cu is giving you
cu: open (/dev/ttyS0): Permission denied cu: /dev/ttyS0: Line in use
even if running as root, you might want to check if /dev/ttyS0 is owned by uucp. If not do a chown uucp /dev/ttyS0
picocom is another simple terminal program:
picocom -b 115200 /dev/ttyS0
If you run a windows box, you can use the hyperTerminal program located in accessory->Communication in the start menu.
Acknowledgements
Thanks to paulbart, kju, m. allan noah, guidoz and Gerald L Clark.
http://groups.yahoo.com/group/nslu2-linux/message/87
http://groups.yahoo.com/group/nslu2-linux/message/1411
http://www.rwhitby.net/nslu2/serial.html - Guide for adding Serial Port with Pictures 对比 RouterBOARD
CPU MIPS32 4Kc based 175MHz embedded processor
Memory 16MB SDRAM onboard memory chip
Boot loader RouterBOOT, 1Mbit Flash chip
Data storage64MB onboard NAND memory chip 原帖由 txwwy 于 2006-6-29 14:29 发表
对比 RouterBOARD
CPU MIPS32 4Kc based 175MHz embedded processor
Memory 16MB SDRAM onboard memory chip
Boot loader RouterBOOT, 1Mbit Flash chip
Data storage64MB onboard NAND memory chip
老大,强啊,是否弄点产品? 这是国外找来的资料吧,楼主有没有成功做好。还有ROS怎样写到SD卡里
拿几百块钱来做实验 即使装不了ROS ,也有很多东西可玩的。另外OPENWRT 不光有 MIPS CPU 内核的源码。也有基于intel IXP 的,可以玩的多了