DSN New User Programming Tutorial
June 2007

Introduction

This tutorial is intended to get the new DSN user up and running, providing step-by-step instructions on downloading DSN and configuring your system, writing programs with increasing levels of complexity, and even looking at the more advanced inner-workings of the system.

Package Download and System Configuration

Downloading DSN onto your computer

The system can be downloaded from the DSN website at: http://db.cs.berkeley.edu/dsn/. If downloading from the website, the location of DSN on the local machine is not important; environmental variables will handle this.

Supplemental System Requirements

In order for DSN to function correctly, there are a few prerequisites (version numbers are important).

DSN currently supports the TelosB/Telos, Micaz, and Mica2 platforms.

Setting up Environment Variables

Once installed, there are three main variables that need to be set in the environment (assuming Cygwin is being used) in order for DSN to work correctly:

Directory Structure Overview

This section is designed to provide a high-level overview of the directory structure of DSN. Greater detail for some sections will be provided later in the tutorial.

Test Run: Downloading My First Program

In order to ensure that everything is working correctly, in this section we download a basic existing application, blink, onto a mote. Switch directories to the DSN Home directory, or DSNDIR. Type the following command (assumes bash):
$ make clean
$ INFILE=snlog2/raw/blink.snl make telosb
$ cd gen
$ make telosb reinstall,0

The first command deletes all files created by any previous dsn compliation process. The second file specifies which Snlog specification is to be compiled and downloaded.

The third command starts the compilation process. You will see a great deal of text fly by. The details are not important, but in essence DSN is optimizing the Snlog specification and then compiling the program into pure nesC code. At the end, you will notice the familiar output from ncc, the TinyOS nesC compiler.

Once you are returned to the command prompt, you will notice a new directory, gen has been created. This directory contains the application-specific code that has been created, as well as the image that must be downloaded onto the motes. The fourth command enters this directory, and finally the final command downloads the image onto a TelosB node, assigning it a local address of 0. If so desired, the micaZ and mica motes, or pc (for TOSSIM) can be used instead.

If all these steps completed successfully, the yellow (or rather blue on the TelosB) LED will be blinking periodically, and your system is successfully set up to use DSN. If you encounter problems, the problem depends on the specific symptoms. If you receive an initial parser error, this typically implies you do not have the correct version of python installed, or that your environmental variables have not been setup correctly. If the nesC compliation process fails, it is likely due to the incorrect version of nesC being installed, or a problem with your TinyOS installation. Finally, if downloading onto the motes fails, this generally indicates a problem with your motes connection to your computer.