1 lab1 objectives get familiar w/ hardware mote interface board mote mote sensor board get...

38
1 Lab1 Objectives Get familiar w/ hardware Mote interface board Mote Mote sensor board Get familiar w/ software MoteWorks Programmer’s notepad Setting up environment

Upload: marcia-nichols

Post on 18-Dec-2015

225 views

Category:

Documents


1 download

TRANSCRIPT

1

Lab1

Objectives Get familiar w/ hardware

Mote interface board Mote Mote sensor board

Get familiar w/ software MoteWorks Programmer’s notepad Setting up environment

2

Crossbow classroom kit

Hardware Mote interface board (MIB)

a.k.a. programmer, gateway, programming board, PC interface board

Mote processor/radio board a.k.a. mote tiny computer w/ radio communication

Mote sensor board a.k.a. Data acquisition board (DAQ board) Temperature, light, humidity, …

Software MoteWorks

3

Crossbow hardware

Mote Interface Board (“MIB”) MIB510 MIB520 MIB600

Mote 433MHz Mica2 868/916MHz Mica2 (MPR400CB) 2.4GHz MicaZ

Sensor board MTS/MDA series MDA100CB

PC

4

Hardware we’ll use

MIB520 Mote Interface Board (“MIB”)

868/916MHz Mica2

Sensor MDA100CB

PC

Feb 2007WSN Training: MW Orientation and Configuration 5

MoteWorks Orientation

Objectives: Review directory structure MakeXbowlocal and environment customization

Lab Blink make command Compiling using Programmer’s Notepad

6

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 XSniffer Programmer’s Notepad 2 GraphViz 2.6 PuTTY Utilities WinMerge 2.4.6.0

Compilers nesC 1.2 AVR-GCC compiler for

Atmel Atmega128 microcontroller

GDB debugger and AVR Insight

7

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.

8

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

9

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

10

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 11

MoteWorks Orientation

Objectives Review directory structure MakeXbowlocal and environment customization

Lab Blink make command Compiling using Cygwin or Programmer’s Notepad

12

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

13

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

14

Review: What MIB Board Do I Have?

MIB520

MIB600MIB510

15

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

16

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=mib510

DEFAULT_PROGRAM=mib520

#DEFAULT_PROGRAM=eprb

#MIB510=COM1

MIB520=com6

#EPRB=10.1.1.238

Lines 14 through 19 of MakexbowlocalNOTE: you should write com6 (instead of COM6)

15

18

This number is the lower of the two COM ports assigned to the

MIB520

17

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

18

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

19

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)

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)

20

MakeXbowlocal: Group ID Editing

Example: Line 30 shown uncommented and edited

with group ID = 12

21

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

22

Editing the Makexbowlocal File (2 of 2)

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

23

Example: Note lines 55 and 57

Setting the Channel for the MICA2 in the 902 MHz to 928 MHz band

24

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

25

Before We Go On

Make 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

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 Orientation

Objectives 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

28

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

29

Lab 1: Setup Gateway and Mote

1. Connect your MIB to your PC with the appropriate cabling. Check that the MIB is powered.

2. When using a MIB520, power is supplied from PC USB port. Turn the power switch on mote to OFF.

30

Step 2b: Attaching Mote to MIB520 Board

MICA2/z Mote

USB cable – power and communication

NOTE: mote should be firmly seated in MIB520.

31

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

5. If MICA2: Select tools > make mica2

6. To install, click on tools > shell. In the dialog box type

make <platform> reinstall <platform> is either mica2 or micaz

32

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)

33

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

34

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

35

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

Example: make mica2 install,1 mib520,com6

36

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

37

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

38

What you need to do

Familiarize yourself with hardware Review directory structure of MoteWorks Familiarize yourself with Programmers Notepad Using Programmer’s Notepad to

Customize MakeXbowlocal (use the same PC for the rest of the semester)

Compile & download Blink Make sure Blink works

Finish lab1 report