Feb 2007WSN Training: MW Orientation and Configuration 1
MoteWorks OrientationObjectives: Review directory structure MakeXbowlocal and environment customization
Lab Blink make command Compiling using Programmer’s Notepad
WSN Training: MW Orientation and Configuration 2 Feb 2007
What SW Packages Are Provided by MoteWorks?
Development Environment Cygwin -- Alternative UI to
view and compile code; Programmers Notepad is the main UI
MoteConfig 2.0 and OTAP -- Separate tutorial
XSniffer -- Part of a Day 2 lab Programmer’s Notepad 2 --
Used throughout training GraphViz 2.6 -- Briefly used TortoiseCVS 1.8.22 -- Not used
in training PuTTY Utilities -- Not used in
training WinMerge 2.4.6.0 -- Briefly
used in training
Compilers nesC 1.2 AVR-GCC compiler for
Atmel Atmega128 microcontroller
GDB debugger and AVR Insight
MoteWorks and TinyOS code Mote Tier XServe Tiers MoteView a separate
installation
WSN Training: MW Orientation and Configuration 3 Feb 2007
Directory Structures
Typical default directory: C:\Crossbow\cygwin\opt\MoteWorks
MoteWorks
apps
make
doc
tools
tos
XMesh, XSensor applications and example programs
nesC Compile utilities for different processor platforms
Documents generated by make utility
Developers utilities and programs
TinyOS “operating system,”modules, and interfaces
MoteWorks
apps
make
doc
tools
tos
XMesh, XSensor applications and example programs
nesC Compile utilities for different processor platforms
Documents generated by make utility
Developers utilities and programs
TinyOS “operating system,”modules, and interfaces
doc folder is not there initially. You will create this later.
WSN Training: MW Orientation and Configuration 4 Feb 2007
Directory Structures
C:\Crossbow\cygwin\opt\MoteWorks\apps
apps
examples
general
tutorials
xmesh
Example applications described in XMesh manual
Basic applications such as Blink and XSniffer
Applications described in Getting Started Guide
Multi-hop apps for various sensorboards
Single-hop apps for various sensorboardsxsensor
apps
examples
general
tutorials
xmesh
Example applications described in XMesh manual
Basic applications such as Blink and XSniffer
Applications described in Getting Started Guide
Multi-hop apps for various sensorboards
Single-hop apps for various sensorboardsxsensor
WSN Training: MW Orientation and Configuration 5 Feb 2007
Directory Structures
C:\Crossbow\cygwin\opt\MoteWorks\tools
tools
bin
motelist
uisp
xserve
Executables for automated tools
Lists attached USB devices
Mote UISP programming utility
XServe server tier middleware
tools
bin
motelist
uisp
xserve
Executables for automated tools
Lists attached USB devices
Mote UISP programming utility
XServe server tier middleware
WSN Training: MW Orientation and Configuration 6 Feb 2007
Directory Structures
C:\Crossbow\cygwin\opt\MoteWorks\tos
tos
interfaces
lib
platform
sensorboards
system
Definitions of TinyOS component interfaces
Major “libraries” such as XMesh, TimeSync
Mote platform specific hardware drivers
Sensor and data acquisition board drivers
TinyOS “services” such as the timers, scheduler
types TinyOS data structures such as Active Messages
radio Radio specific drivers
tos
interfaces
lib
platform
sensorboards
system
Definitions of TinyOS component interfaces
Major “libraries” such as XMesh, TimeSync
Mote platform specific hardware drivers
Sensor and data acquisition board drivers
TinyOS “services” such as the timers, scheduler
types TinyOS data structures such as Active Messages
radio Radio specific drivers
Feb 2007WSN Training: MW Orientation and Configuration 7
MoteWorks OrientationObjectives Review directory structure MakeXbowlocal and environment customization
Lab Blink make command Compiling using Cygwin or Programmer’s Notepad
WSN Training: MW Orientation and Configuration 8 Feb 2007
Customization: MakeXbowlocal
What is MakeXbowlocal? A file that contains common settings to minimize
keyboard entry and typos during compiling and downloading
What will be used to edit the MakeXbowlocal file? Programmers Notepad 2
Where is it? <Install_Drive>:\Crossbow\cygwin\opt\MoteWorks\apps
Open a Programmers Notepad 2 window now
WSN Training: MW Orientation and Configuration 9 Feb 2007
Customization: MakeXbowlocal
What can be defined in MakeXbowlocal?1. Programming board settings
COM port (MIB510 or MIB520) or IP address (MIB600) of the programming board
2. Radio settings Frequency band AND channel Radio transmit (TX) output power
3. Group ID Nodes must share a common group ID in order to
network with each other What is your group ID? It is on your name badge
WSN Training: MW Orientation and Configuration 10 Feb 2007
Review: What MIB Board Do I Have?
MIB520
MIB600MIB510
WSN Training: MW Orientation and Configuration 11 Feb 2007
MakeXbowlocal: Programming Board
1.Uncomment one of the following lines Line 14 if using a MIB510 Line 15 if using a MIB520 Line 16 if using a MIB600 (a.k.a., eprb)
2.Uncomment and edit for COM port of the MIB510/MIB520 or IP address of the MIB600
WSN Training: MW Orientation and Configuration 12 Feb 2007
MakeXbowlocal: MIB510 configuration
For users of USB to RS232 serial converters, you must know port (COM) number assigned to the USB device. Check under start > Control Panel > System > Hardware >
Device Manager > PortsExample definition (in the MakeXbowlocal file) for MIB510
DEFAULT_PROGRAM=mib510#DEFAULT_PROGRAM=mib520#DEFAULT_PROGRAM=eprbMIB510=COM1#MIB520=/dev/ttyS4#EPRB=10.1.1.238
Note: Build system ignores lines which begin with the “#” character
14
17
WSN Training: MW Orientation and Configuration 13 Feb 2007
MakeXbowlocal: MIB520 configuration
Must install the MIB520’s USB driver prior to use FTDI will install 4 different drivers…be patient Run FTClean prior to driver’s installation (see next slide)
Example definition (in the MakeXbowlocal file) for MIB520
#DEFAULT_PROGRAM=mib510DEFAULT_PROGRAM=mib520#DEFAULT_PROGRAM=eprb#MIB510=COM1MIB520=COM7#EPRB=10.1.1.238
Lines 14 through 19 of Makexbowlocal
15
18
This number is the lower of the two COM ports assigned to the
MIB520
WSN Training: MW Orientation and Configuration 14 Feb 2007
MIB520 Notes (Review)
USB port drivers (from FTDI) are in the MoteWorks CD
The MIB520 USB drivers creates two sequentially numbered virtual COM ports COM<#> is for programming and downloading code
in the Mote COM<#+1> is for PC to MIB520 data communications
such as when running MoteView
If the USB driver installed virtual COM port drivers greater than 16, you should uninstall and clean the COM port registries Use the FTClean utility on the MoteWorks CD
WSN Training: MW Orientation and Configuration 15 Feb 2007
MakeXbowlocal: MIB600 configuration
Connection methods to a PC (W)LAN Ethernet hub Crossover Ethernet cable (to directly connect to PC)
Example definition (in the MakeXbowlocal file) for MIB600
#DEFAULT_PROGRAM=mib510#DEFAULT_PROGRAM=mib520DEFAULT_PROGRAM=eprb#MIB510=COM1#MIB520=COM7EPRB=10.1.1.238
16
Lines 14 through 19 of Makexbowlocal
19
WSN Training: MW Orientation and Configuration 16 Feb 2007
Group ID versus Node ID?915 MICA2Channel 00 Group ID = 12
915 MICA2Channel 00 Group ID = 13
1
2
34
5
5
4
3
2
1
Node ID
WSN Training: MW Orientation and Configuration 17 Feb 2007
MakeXbowlocal: Group and Node IDs
Nodes communicate only within a common group ID Values can be in either decimal or hexadecimal Default value is 0x7D (that is, decimal 125), but please
use your Group ID that’s on your name badge
Nodes can be assigned almost any 2-byte number (that is, from 0 to 65535)
Exceptions: Don’t use the reserved broadcast or node addresses Broadcast: 0xFFFF (65535) UART Channel: 0x007E (126)
WSN Training: MW Orientation and Configuration 18 Feb 2007
MakeXbowlocal: Group ID Editing
Example: Line 30 shown uncommented and edited
with group ID = 12
WSN Training: MW Orientation and Configuration 19 Feb 2007
What RF Band is My Mote?
Look at the number on the label with units in “MHZ” or “GHZ”
433 MHz Mica2
868/916 MHz Mica2
2.4 GHz MicaZ
WSN Training: MW Orientation and Configuration 20 Feb 2007
Editing the Makexbowlocal File (2 of 2)
1. For MICA2 users, check three settings1. RADIO_CLASS and RADIO_CHANNEL
Uncomment one of 55, 93, 110, or 128 2. RADIO_CHANNEL
Uncomment one of the RADIO_CHANNEL lines in the appropriate RADIO_CLASS section
3. Radio TX Power Uncomment one line between 153 and 158
2. For MICAz users, check two settings1. RADIO_CHANNEL
Uncomment one line between 173 and 1882. Radio TX Power
Uncomment one line between 207 and 214
WSN Training: MW Orientation and Configuration 21 Feb 2007
Example: Note lines 55 and 57
Setting the Channel for the MICA2 in the 902 MHz to 928 MHz band
WSN Training: MW Orientation and Configuration 22 Feb 2007
Setting the Channel for the MICA2 in the 433 MHz Band
Example: Note lines 110 and 114
902-928 MHz MICA2 can also operate in 868-870 MHz band
WSN Training: MW Orientation and Configuration 23 Feb 2007
MakeXbowlocal: MICA2, RF Transmit Power
Example: MICA2 set to transmit at RADIO_POWER=0x02 or -20 dBm
TX output power options for 868/916 MHz band MICA2
TX output power options for 433 MHz band MICA2
WSN Training: MW Orientation and Configuration 24 Feb 2007
MakeXbowlocal: MICAz, 2.4 GHz, Channel 25
Example: Note lines 187 and 212
Example: Setting power to -15 dBm
WSN Training: MW Orientation and Configuration 25 Feb 2007
Before We Go OnMake sure that the changes in the MakeXbowlocal file are based on your Group ID Type of Mote Interface Board (MIB510, MIB520,
or MIB600) COM port or IP Address
Mote (Mica2 or MicaZ). RADIO CLASS, RF CHANNEL, TX POWER
All other lines else should be comment out with a # symbol
Feb 2007WSN Training: MW Orientation and Configuration 26
MoteWorks OrientationObjectives Review directory structure MakeXbowlocal and environment customization
Lab Blink make command Compiling using Programmer’s Notepad 2 (PN2 on your
desktop)
Feb 2007WSN Training: MW Orientation and Configuration 27
Lab 1: Compile and Installing Firmware to a Mote
Objectives Build and install your first MoteWorks application Verify your MoteWorks compiler tools and
programming environment Get a little more familiar with the hardware
WSN Training: MW Orientation and Configuration 28 Feb 2007
Lab 1 – Materials Needed
Mote (“MPR4x0” or “MPR2400”) One MICA2, MICAz with batteries installed
Mote Interface Board (“MIB”) One of MIB510, MIB520, or MIB600 All associated cabling for data and power IP or COM port settings determined Appropriate drivers installed (if needed)
Your PC with MoteWorks installed
WSN Training: MW Orientation and Configuration 29 Feb 2007
Lab 1: Setup Gateway and Mote
1. Connect your MIB to your PC with the appropriate cabling. Check that the MIB is powered.
2. Attach a MICA2 or MICAz to an MIB via the white board-to-board connector (see next slides for pictures)
• If the MIB510 is powered, switch the MICA’s power switch to off
• If using a MIB520, power is supplied from PC USB port. • Make sure that the red PWR LED is on and green PWR
LED is not blinking.
WSN Training: MW Orientation and Configuration 30 Feb 2007
Mote + Gateway Board = Base Station
• MICA2/z Mote• MIB510
Cables• Power • Wired Comms
Shown with sensor board attached to bottom connector which is not required for programming
Antenna is missing and needs to be there for good RF communication
Step 2a: Attached Mote to MIB510
WSN Training: MW Orientation and Configuration 31 Feb 2007
Step 2b: Attaching Mote to MIB520 Board
MICA2/z Mote
USB cable – power and communication
WSN Training: MW Orientation and Configuration 32 Feb 2007
Step 2c: Attaching Mote to MIB600 Board
MICA2/z Mote
Ethernet cable to LAN or hub
5 VDC wall power supply (POE switch to “5V”)
WSN Training: MW Orientation and Configuration 33 Feb 2007
Lab: Compile and Download with Programmers Notepad
3. Open a Programmers Notepad window and navigate to the Blink directory: /opt/MoteWorks/apps/general/Blink
4. Click on the Blink.nc or BlinkM.nc file
5a. If MICA2: Select tools > make mica25b. If MICAz: Select tools > make micaz
6. To install, click on tools > shell. In the dialog box type
make <platform> reinstall<platform> is either mica2 or micaz
WSN Training: MW Orientation and Configuration 34 Feb 2007
2. View compiler output
1. Choose shell then type in make <platform>
command then hit “Enter”
Programmers Notepad 2 Interface
After compile, click on Tools > shell then type in the appropriate make command (see previous slide)
WSN Training: MW Orientation and Configuration 35 Feb 2007
TinyOS make Command (1 of 3)
To build an TinyOS application we use make to Configure top-level nesC application with user specific
options To find options and their syntax, look under the C:\
Crossbow\cygwin\opt\MoteWorks\make\avr subdirectory Run the nesC precompiler to convert nesC
configurations and modules to C. Compile C code to executable binary for target platform Install code into Mote
The make command can be typed or issued from Programmers Notepad 2 Can also be issued from the same location within a
Cygwin window
WSN Training: MW Orientation and Configuration 36 Feb 2007
TinyOS make Command (2 of 3)
Makefile in MoteWorks\make\scripts
Makerules in MoteWorks\make\scripts
MakeXbowlocal
ncc nesC precompiler
avr-gcc C cross compiler-linker
UISP upload code to Mote
TinyOS code image in Mote
TinyOS application source files make <platform> install …
Makedefaults
WSN Training: MW Orientation and Configuration 37 Feb 2007
TinyOS make Command (3 of 3)
make command summary
make <platform> re|install,<n> <programmer>,<COM# or IP_Addr>
mica2, ormicaz, ormica2dot
mib510, ormib520, oreprb (= mib600)
COM# where # = COM port where your MIB510 is attached or the lower of the two virtual COM ports assigned by the MIB520 USB driver
IP address as determined or assigned by using the Lantronix’s DeviceInstaller softwarereinstall,<n> = Download code
that is already compiled with node ID = ninstall,<n> = compile then download code to the Mote with node ID = n
WSN Training: MW Orientation and Configuration 38 Feb 2007
Lab Step 3: Compile for nescdoc
In PN2 click on Tools > shell
Type make <platform> docs
Open a Web UI (Internet Explorer, Mozilla Firefox)
Browse to the folder in C:\crossbow\cygwin\opt\MoteWorks\docs\nesdoc\<platform>
Open allfiles_f.html. Select Components. Click on the Blink hyperlink
WSN Training: MW Orientation and Configuration 39 Feb 2007
GraphViz Help
A requires interface I, B provides I, and A and B are wired together.
C and D both require or both provide J. The direction of the arrow indicates that the original wiring is "C = D".
E requires function f, and F provides function
Feb 2007WSN Training: MW Orientation and Configuration 40
Q & A -- MoteWorks Installation
Objectives: Install MoteWorks Review Directory structure Customize programming environment, including MIB
interfaces
Lab Blink make command Compiling using Cygwin or Programmer’s Notepad
Feb 2007WSN Training: MW Orientation and Configuration 41
Appendix A
Topics Programmer’s Notepad configuration
WSN Training: MW Orientation and Configuration 42 Feb 2007
Programmer’s Notepad Customization
From menu Tools > Options select1. Click on Tools2. NesC-TinyOS from Scheme
dropdown3. Highlight an item in the namelist4. Click on edit to modify
Parameters box.