Getting started with S-MAC stack (v1.2) for motes
If you are using TinyOS CVS repository at Sourceforge, you do not need
to download and extract the tarball. Just do 'cvs update -d' to get it
from there, and you can directly go to Section 2.
1. Extract the tarball
Suppose you are using the TinyOS
release 1.1.0, and you should have the following directories under the tinyos-1.x/ directory.
apps doc tools tos
Make a new directory named contrib/
under tinyos-1.x/.
Put
your tarball into tinyos-1.x/contrib/.
Extract it by
tar -xzvf
smac-stack-1.2.tar.gz
2. Running applications
Now you should see the new directory s-mac/. You can browse
through each subdirectory for details. Followings are some examples.
In apps/
Snooper/
Listens for all packets and send them to UART
PhyTestSender/
transmitter part to test the physical
layer
PhyTestReceiver/
Receiver part to test the physical
layer
SMACTest/
Application to test S-MAC
Chirp/
Demonstration
of the compatibility with Berkeley's standard radio stack
Please read the detailed
README file for each application its own directory.
In tools/
snoop.c
Running on PC to receive each packet sent by the
snooper, and display its contents
It supports both Mica and Mica2 (with
Chipcon
CC1000 radio).
The snooper is a useful tool for debugging and testing. You can see
details in each packet on the PC. The test applications in the apps/ directory provides
examples about how to use the stack at both physical layer and MAC
layer.
The first thing you can try is to run the application to test the
physical layer. Program a snooper
, a PhyTestSender and
a PhyTestReceiver.
The sender will send 4 groups of packet, with either fixed length or
variable length and different packet intervals. The receiver will blink
it LEDs to show successful receptions. It also sends a packet to report
its reception result at the end of each group.
Please note that the payload of each packet from the sender
is NOT always zero, since the memory is not cleared for each packet. So
a long packet following a short packet contains all the old bytes of
the
short packet. It may looks like the packet is corrupted. But it is not,
and it is just having a non-zero payload.
Now you can try SMACTest/
by programming 3 motes and let them send to each other by either
broadcast or unicast. Look at the README file in that directory for
details. Please note that there is an initial setup time (about
12 seconds) for each node to listen for any exsiting neighbor's
schedules. The nodes won't send packets before they find any neighbors.
By default, each mote alternatively sends broadcast and unicast
messages. There are various configurations are available to test S-MAC.
Please see config.h file for details.
The Chirp application is copied from the main TinyOS application
directory
(tinyos-1.x/apps/Chirp/). With virtually no modification (except
including
a few header files), the chirp application can run over S-MAC. You can
program
two motes with chirp, and see how they send to/receive from each other.
3. Note
In each application's directory, there is a config.h file, which is
used
to system-wide configuration, such as the options to the physical
layer,
S-MAC and the application itself. In pre-nesC environment, part of the
work
is done in each application's Makefile.
The idea is to let each layer export tunable parameters, so that each
application
can adjust them in a central place according to its needs.
Last modified by Wei Ye
on June 15, 2004.