Now
that we have TinyOS set up, we can try and upload a few programs into the
motes. This section deals with setting up the basic mote toolkit so that
we can begin uploading programs to the motes and run them.
The basic toolkit comes with 3 mica2 motes, 2 sensor boards and an MIB510
interface board. Notice that you can plug in the sensor boards into the
mica2 motes. We won’t need the sensor boards for the initial setup
though.
For uploading a program into a mote, do the following:
- Go into the /opt/tinyos-1.x/apps/Blink folder. You should see a few
.nc files and a Makefile. We use the Blink application to illustrate how
to upload a NesC program to a mote.
- Place the mote board into the bay on the MIB510. We recommend powering
the MIB510 with a 3V supply to the connector on it(Batteries caused us
a few problems). You should see the red LED on the MIB510 turned on at
this point.
- Plug the MIB510 into the serial port of the computer in which you have
TinyOS installed(We used COM1).Turn the MIB510 on(there is a switch for
doing that on the MIB510).
- To the Makerules file in /opt/tinyos-1.x/apps, set the radio frequency
by adding the following line at the end of the file
PFLAGS += -DCC1K_DEF_FREQ=916700000 .
You might have to set the frequency to the appropriate value based on
the motes you are using. The above value is specific to the configuration
we mentioned above.
- Type ‘MIB510=/dev/COM1 make mica2 install’ at the command
line. You should see something similar to the following:
$ MIB510=/dev/COM1 make mica2 install
avr-objcopy --output-target=srec binr
uisp -dprog=dapa -dno-poll -dlpt=3 --
Atmel AVR AT90S8535 is found.
Erasing device ...
Reinitializing device
Atmel AVR AT90S8535 is found.
sleep 1
uisp -dprog=dapa -dlpt=3 --upload if=
Atmel AVR AT90S8535 is found.
Uploading: flash
sleep 1
uisp -dprog=dapa -dlpt=3 -dno-poll --
Atmel AVR AT90S8535 is found.
Verifying: flash
make: Nothing to be done for `mica'
If you see this, you have just successfully uploaded a program to the
mote. You can now unplug the mote, put in batteries and turn it on. You
should see the red LED blinking periodically.
Important note: When the mote is plugged in to an external power supply(during
the upload process), make sure the batteries are not in the motes. This
could cause hardware damage.
Troubleshooting
There are a few common errors that can show up, especially with the older
MIB500. We cover the following below and offer a few things you can try
out:
1. You get flash errors when you run ‘make mica2 install’
Suggestions: Make sure you have the TinyOS installation on the c drive.
If you have it installed on another drive, look at the TinyOS documentation
on how to resolve this. Next, try following the instructions given in
http://www.xbow.com/Support/Support_pdf_files/UISPHELP.pdf
for minimizing flash errors, especially in the last page. If none of this
solves the problem, you could possibly have hardware problems with the
mote or the MIB500.