Example applications

4. Code Overview

You can browse the code online here, download a copy. The code is located under the DIKU projects in the TinyOS contrib section. The code is split in 3 places: the mcs51 specific, sensinode specific and platform independent (common). A few simple examples are provided in the mcs51 section, more elaborate examples are provided as part of the "common" section of the . The Sensinode Nano platform is provided in the sensinode section.

4.1 Common

This directory contains all of the code common to the project found in the diku directory. The provided applications and libraries are compatible with all the provided platforms.


 common
 +--apps
 |  +--TTXDemo                      - 3 part sample, forward, display app.
 |     +--README                    - Instructions on how to compile and run
 |     +--SampleForwardBase         - Base station with serial connection to PC
 |     +--SampleForwardNode         - Wireless sample, forward mote
 |     +--PC_display                - PC display app.
 |  +--CompressionTest              - Compress data from UART
 |     +--README                    - Instructions
 |  +--TestSimpleMac
 +--lib                             - Platform independent utility libraries
 |  +--logger                       - An event logging library
 |  +--sipmlemac                    - A simple MAC protocol
 |  +--stdout                       - A text printing library (i.e. for debugging)
 |  +--compression                  - A general purpose compression library with plugin
                                      compression methods (simple, lz77, huffman)

3.2 mcs51

This directory contains all the code specific for the 8051 platforms (e.g. CC2430)


mcs51
 +--apps
 |  +--Test2430All                  - Simple test app.
 |  +--Echo                         - Echo chars from UART
 |  +--BlinkNoTimerTask             - Blink leds without the use of timers
 +--support
 |  +--make
 |     +--cc2430em.target            - T2 .target definition
 |     +--mcs51
 |        +--mcs51.rules             - Make rule definitions
 |        +--CC2430-F128.bat         - Keil compile scrip
 |        +--cilly.exe               - UTAH inliner
 |        +--utah-inliner.pl         - Wrapper script for UTAH inliner
 |        +--clean.extra             - Additional cleanup
 |        +--inline.extra            - Make rules for inline
 +--tos
 |  +--platforms
 |     +--micro4                     - Micro4 platform definition
 |     +--nano                       - Nano platform definition

4.3 Sensinode

This directory contains the code specific to the Sensinode platform (e.g. Nano and Micro.4)


 sensinode
 +--tos
 |  +--platforms
 |     +--nano                       - Nano platform definition
 |     +--micro.4                    - Micro.4 platform definition

3. Example applications

To get you started with the platform a few example applications have been provided (see below for full list). Here we will describe a few of them. For all of them compile them as above.

3.1 Echo

This application receives characters from the UART and sends them back. Compile and install the application and connect a terminal emulator to the serial port (230400 baud, 8n1) and type away.

3.2 USBSerialEcho

This appliation is indentical to Echo exept it uses the USB serial port emulation (USB Communication Class device). So while this application is very simple it tests the rather complicated USB CDC implementations.

3.3 TTXDemo

This application is split in 3 parts:

  1. A mote samples an analog sensor and sends it wirelessly to a base station
  2. The base station passes the reading to a PC via a UART
  3. The PC displays the reading on the screen

http://www.tinyos8051wg.net/files/Demo_small.png

The README file provided with the application gives full instructions.

3.4 CompressionTest

The CompressionTest compresses data on a mote using one of 3 algorithms: lz77, huffmann or simple. The data is sent from a PC that also records the timing. It has two parts:

  1. A PC side sends data to the mote using the UART and records the timing.
  2. The mote receives the data, compresses it and sends it back

The README file provided with the application gives full instructions.

3.5 TestSimpleMac

SimpleMac test application for Nano/Micro.4 platforms

3.6 BlinkNoTimerTask

This application replaces the Echo application from the main distribution (which will not work with certain 8051 compilers e.g. Keil, IAR). It blinks the Led's with out using a timer using a simple delay loop. This application is much simpler than the Blink application from the main TinyOS distribution which requires operational timers.

In addition it uses a task as opposed to Blink, since at least 1 task is required by some of the compilers supported by the TinyOS 8051wg port.

3.7 LogRecorder, Testlogger

Part of the logrecorder library (see libraries for further).

3.8 TestAll

Test a variety of device drivers (Uart, Adc, etc.) two platforms:

  • Sensinode Micro.4
  • Texas Instruments cc2430em

The application waits for user input on the UART, the commands are:
l: Toggle Led0
q: Transmit a packet (using SimpleMac)
p: Toggle packet length (13/127)
w: Toggle radio on/off
e: Enable reception
a: Increase channel number (from 11 to 26)
s: Decrease channel number
r: Read a page from FLASH
t: Write a page in FLASH
y: Erase a page in FLASH
u: Read ADC