TinyOS Tutorial: System and Hardware Verification

Last updated 1 Aug. 2002

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.

Change into your alpha/tools directory and run toscheck. The output should be:

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 mote hardware only.  If you have different hardware platform, this application is not suitable.

Change to the apps/MicaHWVerify directory and type

   

		make mica 

The compilation process should complete without any errors. If it compiled correctly it will print out a profile of the memory used by the application.  It should look like:

grep _e binmica/img.file | grep =\.
0x000015a0 _etext=.
0x00800072 _edata=.
0x008000b6 _end=.
0x00810000 __eeprom_end=
.

Next step is to install the application onto a mica node.  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, type 

		make mica install

                           

The output should look like:


Makefile:5: warning: overriding commands for target `all'
../Makeinclude:201: warning: ignoring old commands for target `all'
make: Nothing to be done for `mica'.
avr-objcopy --output-target=srec binmica/main.exe binmica/main.srec
uisp -dprog=dapa -dlpt=3 --erase
pulse
Atmel AVR ATmega103 is found.
Erasing device ...
pulse
Reinitializing device
Atmel AVR ATmega103 is found.
sleep 1
uisp -dprog=dapa -dlpt=3 --upload if=binmica/main.srec
pulse
Atmel AVR ATmega103 is found.
Uploading: flash
sleep 1
uisp -dprog=dapa -dlpt=3 --verify if=binmica/main.srec
pulse
Atmel AVR ATmega103 is found.
Verifying: flash

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 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. Compiler  and run this tool. The commands are shown below assuming you are using COM1 to connect to the programming board.

		
      javac hardware_check.java
      java hardware_check COM1

The output on the PC should be:

hardware_check started
printing all ports...
- COM3
- COM1
- LPT1
- LPT2
done.
baud rate: 9600
data bits: 8
stop bits: 1
parity: 0
baud rate: 19200
data bits: 8
stop bits: 1
parity: 0
Node Serial ID: 1 60 48 fb 6 0 0 1d

Hardware verification successful.

This program checks the serial ID of the mote, 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 GenericBase.  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.  the indication of a working radio system is again Hardware verification successful.

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