This webpage is intended to be a compilation of hints that would simplify the process of programming the motes for those at UCLA and ISI, and details about tinyos components that are contributed by us.
Prerequisites: Perl and C compiler
Step 1: Create a directory called /usr/local/atmel
Step 2: cd /usr/local/atmel; tar -xvzf mote_tools.tar.gz
Step 3: mv mote_tools/* .
Step 4: Add /usr/local/atmel/bin/ to path
Download the current release from release/tos-latest.tar.gz and install it in your home directory. A local CVS of tos and components that we have added has been created at lecs.
Step 1: Uncomment the line "DESC = apps/cnt_to_rfm.desc"
(make sure all other DESC lines are commented)
Step 2: make
This should compile without errors. The last few lines if it compiles correctly should be something like below.
0x00000f92
_etext=.
0x00800064
_edata=.
0x00800115
_end=.
0x00000000
__eeprom_end=.
The above gives the memory usage by the executable.
0x00000f92
_etext=. ---------- Program memory (max 8K)
0x00800064
_edata=. ---------- The difference between _edata and _end gives the
0x00800115
_end=. ------------ the data memory usage
0x00000000
__eeprom_end=. ---- EEPROM usage
Step 3: If you have a mote, do a 'make install' as root, and you should see all the leds blinking in some random order.
To test it, do the following:
Step 1: Uncomment 'DESC = apps/cnt_to_rfm.desc'
in MakefilePC and comment all other DESC lines
Step 2: make clean; make -f MakefilePC
Step 3: cd RF_simulator; make; java ConnectionManager
Step 4: ./main 1 // main is the executable, and 1 is
the id that the node identifier which is used to identify different nodes.
At this point, you should see main output a continuous stream of packets
tick:Sending message: ffffffff, 4ffffffff,4,13,16,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,::33
and the connection manager recvs the packets and prints
read data from 1 554
checking 1
The RF channel is simulated as a set of ideal connections between nodes. The README in the directory provides information on how to modify the connections between nodes.
To test packets flowing between 2 processes,
Use the chirp application, which takes a photo sensor reading and sends it out through the radio, and receives photo sensor readings from neighboring nodes, and flashes leds correspondingly.
Step 1: Uncomment 'DESC = apps/chirp.desc' in MakefilePC
and comment all other DESC lines
Step 2: make clean; make -f MakefilePC
Step 3: java ConnectionManager
Step 4: ./main 1
Step 5: ./main 2
You should see packets flowing between the 2 processes.
NOTE: The above may not work the first time i.e. you wont see both processes receiving packets from the other. In this case, check /system/include/MSG.h. In line 2, change "#define DATA_LENGTH 30" to "#define DATA_LENGTH 27". Alternatively you could change the packet size in the RF_simulator (MoteConnection.java) to be 608 bits instead of 554.
These bit count numbers come from 14 (start symbol) + 18(bits/byte)*30(number of bytes in packet) = 554 or 14 + 33 * 18 = 608.
To see this working,
Step 1: Install cnt_to_rfm.desc Mote 1 as described.
Step 2: Install generic_base.desc on Mote 2
Step 3: With Mote 2 connected to the programming board (with
serial cable)
cd tools; make listen; su; ./listen ... This listens to /dev/ttyS0
and prints packets onto stdout.
You should now see packets being printed out like this
7e,4,13,5,1,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
with byte 4 being incremented with each packet.
The best way to learn to program in tos is to write a component on your own. The following sample is taken from the TinyOS Bootcamp.
Program a couple of motes with apps/sens_to_rfm.desc OR apps/sens_to_leds_and_rfm.desc
Write an Aggregator component, that receives photo sensor readings transmitted by the above motes, looks for the max over, say 10 samples, and sends this out on the radio.
Transceiver -- Jeremy
Diffusion -- Deepak
Beacon -- Vlad