TinyOS Tutorial: System and Hardware Verification

Last updated 23 September 2003

When working with embedded devices, it is very difficult to debug applications.  Because of this, you want to make sure that the tools you are using are working properly and that the hardware is functioning correctly. This will save you countless hours of searching for bugs in your application when the real problem is in the tools. This lesson will show you how to check your system and the hardware.

PC tools verification

A TinyOS development environment requires the use of avr gcc compiler, perl, flex, cygwin if you use windows operation system, and JDK 1.3.x or above. We provide a tool named toscheck to check if the tools have been installed correctly and that the environment variables are set.

Run toscheck (it should be in your path - a copy is also in tinyos-1.x/tools/scripts). The output should be something like:

toscheck
Path:
/usr/local/bin
/usr/bin
/bin
/cygdrive/c/jdk1.3.1_01/bin
/cygdrive/c/WINDOWS/system32
/cygdrive/c/WINDOWS
/cygdrive/c/avrgcc/bin
.

Classpath:
/c/alpha/tools/java:.:/c/jdk1.3.1_01/lib/comm.jar

avrgcc:
/cygdrive/c/avrgcc/bin/avr-gcc
Version: 3.0.2

perl:
/usr/bin/perl
Version: v5.6.1 built for cygwin-multi

flex:
/usr/bin/flex

bison:
/usr/bin/bison

java:
/cygdrive/c/jdk1.3.1_01/bin/java
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

Cygwin:
cygwin1.dll major: 1003
cygwin1.dll minor: 3
cygwin1.dll malloc env: 28

uisp:
/usr/local/bin/uisp
uisp version 20010909


toscheck completed without error.

 

The last line is the most important.  If any errors are reported, make sure to fix the problem.

 Hardware Verification

To test the hardware, we have provided an application: MicaHWVerify.  It is designed  for the purpose of verifying mica/mica2/mica2dot mote hardware only.  If you have a different hardware platform, this application is not suitable.

Change to the apps/MicaHWVerify directory and type

(mica platform)		make mica		
(mica2/mica2dot)	PFLAGS=-DCC1K_MANUAL_FREQ=<freq> make [mica2|mica2dot] 

For the mica2/mica2dot, see the MICA2 Radio documentation for how to choose <freq>. The compilation process should complete without any errors (Compilation for the mica2dot will generate a warning about the SerialID component). If it compiled correctly, it will print out a profile of the memory used by the application. While the exact build directory and memory footprints will vary depending on your platform, it should look like:

compiled MicaHWVerify to build/mica2/main.exe
       10386 bytes in ROM
       390 bytes in RAM
avr-objcopy --output-target=srec build/mica2/main.exe build/mica2/main.srec

Next step is to install the application onto a mote.  Place a powered-on node into a programming board.  The red LED on the programming board should light.  Connect the programming board to the parallel port of your computer.  To load the program on to the device, using a parallel port programmer, type 

		make reinstall [mica|mica2|mica2dot]

See "Device Programmer Tools" for installation instructions for other programmers. The output should look like:

installing mica2 binary
uisp -dprog=<yourprogrammer> -dhost=c62b270 -dpart=ATmega128 --wr_fuse_e=ff --erase --upload if=build/mica2/main.srec
Atmel AVR ATmega128 is found.
Uploading: flash
Fuse Extended Byte set to 0xff

Now you know that the programming tools and the computer's parallel port are working. The next step is to verify the mote hardware. First, confirm that the LEDs are blinking like a binary counter. Next, connect the programming board to the serial port of the computer. The hardware verify program will send data over the UART that contains it status.  To read from the serial port, we provide a java tool called hardware_check.java. It is located in the same directory. Build and run this tool. The commands are shown below assuming you are using COM1 at 57.6 KBaud to connect to the programming board.

		
make -f jmakefile
MOTECOM=serial@COM1:57600 java hardware_check

See "Serial-line communication in TinyOS" for more information on how to specify a serial port (or other communication method) for use with hardware_check. The output on the PC should be something like:

hardware_check started
Hardware verification successful.
Node Serial ID: 1 60 48 fb 6 0 0 1d

This program checks the serial ID of the mote (except on the mica2dot), the flash connectivity, the UART functionality and the external clock.  If all status checks are positive,  the hardware verification successful message will be printed on your PC scream. If you see any failure report on your monitor, you might need get another mote.

Radio Verification

To verify radio, you need two nodes.  Take a second node (that has passed the hardware check up to this point) and install it with TOSBase. This node will act as a radio gateway to a second node.  Once installed, leave this node in the programming board and place the original node next to it.  Re-run the hardware_check java application. The output should be the same as shown in the previous section (but will display the serial ID of the remote mote). The indication of a working radio system is, again, something like:

hardware_check started
Hardware verification successful.
Node Serial ID: 1 60 48 fb 6 0 0 1d

If the remote mote is turned off or not functioning, it will return a message "Node transmission failure".

If your system and hardware pass all the above tests, you are all set for having some fun with TinyOS. Congratulations.


Tutorial Index