The goal of this chapter is to get you up and running as quickly as possible. For our purposes, we will assume that you have already checked out a copy of the TinyOS source tree, have a Linux development machine running a 2.6 kernel, and have three Telos revision B motes available.
You'll need copies of the MSP430 tool chain, the bootstrap loader, and the TinyOS source tree.
Set up your environment variables in your .bash_profile or other appropriate location. My version looks like:
# Tiny OS settings PATH=$PATH:/usr/local/msp430/bin:/usr/local/tinyos/bin TINYOSDIR=/home/andyc/repository/tinyos-1.x TOSDIR=$TINYOSDIR/tos MAKERULES=$TINYOSDIR/tools/make/Makerules
First, let's run an 802.15.4 scanner software. This can be found in contrib/handhelds/apps/ZSniff. Assuming that you have a Telos B mote attached to /dev/ttyUSB0, type:
By default, the zdump program uses 802.15.4 channel 11 and displays output on a single line. Here's some sample output:9.53 BEACON beacon_order=15 superframe_order=0 final_cap_slot=0 PANCOORD fcf=8000 [BEACON] dsn= 83 src=00:6e/00:00 4a:61:6d:65:79:27:73:20:4f:66:66:69:63:65:00 rssi=-9 lqi=107 crc=True 9.53 DATA_REQUEST fcf=8023 [COMMAND ACKREQUEST] dsn= 42 src=be:ef/00:01 rssi=18 lqi=106 crc=True 9.53 ACK fcf=0012 [ACK FRAMEPEND] dsn= 42 rssi=-10 lqi=107 crc=True 9.55 BEACON beacon_order=15 superframe_order=0 final_cap_slot=0 PANCOORD fcf=8000 [BEACON] dsn=229 src=00:67/00:00 54:65:61:6d:41:72:65:61:00 rssi=-10 lqi=106 crc=True 9.60 BEACON beacon_order=15 superframe_order=0 final_cap_slot=0 PANCOORD fcf=8000 [BEACON] dsn= 23 src=00:6f/00:00 4a:61:6d:65:79:27:73:20:4f:66:66:69:63:65:00 rssi=3 lqi=107 crc=True 9.61 BEACON_REQUEST fcf=0803 [COMMAND] dsn=247 dest=ff:ff/ff:ff rssi=-44 lqi=105 crc=True 9.61 BEACON beacon_order=15 superframe_order=0 final_cap_slot=0 PANCOORD ASSOC_OK fcf=8000 [BEACON] dsn= 38 src=be:ef/00:0c 43:52:4c:2d:4d:65:64:69:63:61:6c:00 rssi=-9 lqi=107 crc=TrueThere are options to the zdump program to decode TCP/IP traffic, display multiple lines per packet, set and hop channels, and filter packets by type. (* Add link to zdump reference here *)
The HP TinyOS tree provides clients that can communicate using TCP/UDP over IP over 802.15.4. An access point is needed to connect the wireless 802.15.4 client back to the wired Ethernet. We have a hardware project to build a small embedded Linux computer with wired Ethernet and 802.15.4 radios (* add link here *). For people without the hardware, the contrib/handhelds/apps/AccessPoint software configures a Telos Mote to act as basic access point. Wired Ethernet traffic from the Mote is sent over the USB cable to a host PC running a custom Linux kernel module.
We'll assume that you have a Linux development machine running kernel version 2.6 and a Telos Mote connected to /dev/ttyUSB1. The first step is to build and install the kernel module that routes IP traffic:
Now we install the access point software on the Mote.
cd contrib/handhelds/apps/AccessPoint make telos IP=10.0.1.1 LONG_ADDRESS=1 install bsl,/dev/ttyUSB1
IP
address for the access point. The Telos Mote will be
acting as a network interface card for your Linux computer,
and as such, it needs to have a network address. Some day we
will try to remove this restriction so you can assign the
address using ifconfig or equivalent.
Second, you had to specify a LONG_ADDRESS
.
This two byte value is used to create a unique network MAC
address for the CC2420 radio. The LONG_ADDRESS
is not needed for devices that have a DS2411 identification
chip (such as the Telos revision B or TMote Sky motes).
The third step is to running the access point user-space daemon. The daemon sets up the kernel module and updates routing tables.
If the daemon is running correctly, you should see something like:Device name telos0 Event: Reset IP: 10.0.1.1 Addr: a0:a0:00:00:00:00:00:01 PanID: 0xbeef Freq: 2405 (channel 11) SSID: CRL-Medical setting host ip addressThe zattach program handles updating the routing tables as clients join and leave the access point. However, you won't be able to connect to those clients outside of your local Linux machine unless you turn on IP forwarding: Remember, if you are going to forward packets off of your local computer, you need to supply routable IP addresses.
Notice that the output of the zattach program contains the device name telos0. This is an actual Linux network device. Try ifconfig to see its settings or running ethereal and watching the network traffic on the device.
Now we'll install and test a simple Telnet client that runs over 802.15.4. We'll assume that you have a Telos revision B mote plugged into /dev/ttyUSB2.
As with the access point, if you are running a client device that doesn't have a DS2411 identification chip, you must specify a uniqueLONG_ADDRESS
value.
The client will scan all of the local 802.15.4 channels, locate available access points (by sending BEACON REQUEST packets), select the best access point, and associate with it. If everything goes well, you should see the output of the zattach program displaying:
Event: Associate IP: 0.0.0.0 Addr: a0:a0:00:00:0c:59:f8:53 SAddr: 0 Flags: 0x81 Event: ARP IP: 10.0.1.2 Addr: a0:a0:00:00:0c:59:f8:53 SAddr: 0 Flags: 0x81 adding client routeNow you should be able to run ping 10.0.1.2 and telnet. You can watch packets fly back and forth both from the zdump software that shows you what is going over the air and from tcpdump or ethereal running on the telos0 interface.