Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course -...

24
1 7/9/2007 AIIT Summer Course - M3-TinyOS WSNs 1 Wireless Embedded Systems and Networking Foundations of IP-based Ubiquitous Sensor Networks Operating Systems for Communication-Centric Devices TinyOS-based IP-WSNs David E. Culler University of California, Berkeley Arch Rock Corp. July 9, 2007 7/9/2007 AIIT Summer Course - M3-TinyOS WSNs 2 Technology Perspective tier1 tier1 tier2 tier2 Client Client Server Server embedded net embedded net Physical World Physical World IT Enterprise IT Enterprise internet internet Sensor Sensor tier4 tier4 Mote Mote tier3 tier3 Routers, Routers, APs APs, , Gateways Gateways Embedded Tier: (mote) Router/Gateway Tier: • Linux, Linux, Linux Server Tier: • Unix (Linux, Solaris, AIX, HPux), Windows • App Servers (Axis, J2EE, Weblogic, SAP, Oracle, …) Client Tier: (desk,lap,PDA,MP3, phone) • Windows, Wince, Symbian, Linux/Java

Transcript of Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course -...

Page 1: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

1

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 1

Wireless Embedded Systems and Networking

Foundations of IP-based Ubiquitous Sensor Networks

Operating Systems for Communication-Centric DevicesTinyOS-based IP-WSNs

David E. CullerUniversity of California, Berkeley

Arch Rock Corp.July 9, 2007

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 2

Technology Perspective

tier1tier1

tier2tier2

ClientClient

ServerServer

embedded netembedded net

Physical WorldPhysical World

IT EnterpriseIT Enterprise

internetinternet

SensorSensor

tier4tier4MoteMote

tier3tier3 Routers, Routers, APsAPs, , GatewaysGateways

Embedded Tier: (mote)

Router/Gateway Tier:• Linux, Linux, Linux

Server Tier:• Unix (Linux, Solaris, AIX, HPux), Windows• App Servers (Axis, J2EE, Weblogic, SAP, Oracle, …)

Client Tier: (desk,lap,PDA,MP3, phone)• Windows, Wince, Symbian, Linux/Java

Page 2: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

2

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 3

Traditional Systems

• Well established layers of abstractions

• Strict boundaries• Ample resources• Independent

Applications at endpoints communicate pt-pt through routers

• Well attended

User

System

Physical LayerData LinkNetwork

TransportNetwork Stack

Threads

Address Space

Drivers

Files

Application

Application

Routers

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 4

by comparison, WSNs ...

• Highly Constrained resources– processing, storage, bandwidth, power

• Applications spread over many small nodes– self-organizing Collectives – highly integrated with changing environment and network– communication is fundamental

• Concurrency intensive in bursts– streams of sensor data and

network traffic• Robust

– inaccessible, critical operation

• Unclear where the boundaries belong

– even HW/SW will move

=> Provide a framework for:

• Resource-constrained concurrency

• Defining boundaries

• Appl’n-specific processing and power management

allow abstractions to emerge

Page 3: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

3

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 5

TinyOS• New operating system built specifically for

wireless sensor networks– Small, robust, communication centric design– Resource-constrained concurrency– Structured Event-driven SW architecture– Tool for protocols and dist. Algorithms

• Designed for synthesis and verification– Eg. Ptolemy, Metropolis, …– Whole-system compile-time analysis

• Rich set of services and development environment

• World-wide adoption– Open source, lead by UCB / Intel– Corporate and academic (1000s)– Dozen of platforms– de facto sensor net standard

CC2420

Radio byte

Radio Packet

UART

Serial Packet

ADC

Temp photo

Active Messages

clocksbit

byte

pack

et

Route map router sensor appln

appl

icat

ion

HW

SW

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 6

A worldwide community

StorageWireless Processing

Sensors

SmartDustNEST

Wireless Sensor Networks

Page 4: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

4

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 7

Sensors

Modern Mote Tier TinyOS Architecture

tier1

tier2

client

server

tier3 SensorNetGW/Proxy

physical info net

MCU Radio SensorsHardware Abstraction Layer

TinyOS Runtime ServicesCommon Link Abstraction

Networking Protocols

Managem

ent

• Embedded applications built on a rich set of node services.

– Timing, sensor streams, storage– Local processing– Reliable, low-power communication– Platform independent + extensions

Embedded Applicationtier4

“mote”

Physical World

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 8

Storage ProcessingWireless SensorsWSN mote platform

Abstractions Emerge from Experience

Radio Serial

Flash ADC, Sensor I/F

MCU, Timers, Bus,…

Link

NetworkProtocols Blocks,

Logs, FilesScheduling,

ManagementStreaming

drivers

Over-the-air Programming

Applications and Services

Communication CentricResource-ConstrainedEvent-driven Execution

Tiny

OS

2.0

Page 5: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

5

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 9

Stack Library Alternative

MicroController

802.15.4 Radio

Hardware

Software cmds interrupts

Proprietary

Network Stack(zigbee spec or

other)

cmds interrupts

sendstartstop

OEM / Developer

Custom Code,

RTOS, or otherTICK

OEM/Dev Hardware

• Link & networks protocols buried in block-box library

– Ember, Figure8, . . .

• No execution model or storage model

• Arbitrary system/user code must TICKle it “sufficiently often”

• Undefined call duration• No system services• Difficult to validate

• Same hardware, but a very different approach

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 10

TinyOS from First Principles

Page 6: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

6

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 11

Characteristics of Network Sensors• Small physical size and low power consumption• Concurrency-intensive operation

– multiple flows, not wait-command-respond• Limited Physical Parallelism and Controller

Hierarchy– primitive direct-to-device interface– Asynchronous and synchronous devices

• Diversity in Design and Usage– application specific, not general purpose– huge device variation=> efficient modularity=> migration across HW/SW boundary

• Robust Operation– numerous, unattended, critical=> narrow interfaces

sensorsactuators

network

storage

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 12

Classical RTOS approaches• Responsiveness

=> Provide some form of user-specified interrupt handler» User threads in kernel, user-level interrupts

– Guarantees?• Deadlines / Controlled Scheduling

– Static set of tasks with prespecified constraints» Generate overall schedule=> Doesn’t deal with unpredictable events, especially communication

– Threads + synchronization operations=> Complex scheduler to coerce into meeting constraints

• Priorities, earliest deadline first, rate monotonic• Priority inversion, load shedding, live lock, deadlock

» Sophisticated mutex and signal operations• Communication among parallel entities

– Shared (global) variables: ultimate unstructured programming– Mail boxes (msg passing)

=> external communication considered harmful– Fold in as RPC

• Requires multiple (sparse) stacks– Preemption or yield

Page 7: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

7

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 13

Alternative Starting Points• Event-driven models

– Easy to schedule handfuls of small, roughly uniform things» State transitions (but what storage and comm model?)

– Usually results in brittle monolithic dispatch structures• Structured event-driven models

– Logical chunks of computation and state that service events via execution of internal threads

• Threaded Abstract machine– Developed as compilation target of inherently parallel languages

» vast dynamic parallelism» Hide long-latency operations

– Simple two-level scheduling hierarchy– Dynamic tree of code- block activations with internal inlets and threads

• Active Messages– Both parties in communication know format of the message– Fine-grain dispatch and consume without parsing

• Concurrent Data-structures– Non-blocking, lock-free (Herlihy)

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 14

TinyOS design goals

• Simple framework for resource constrained concurrency– Single stack

• Flexible hardware/software and system boundary• Expressive enough to build sophisticated, application specific

system structures– Avoid arbitrary constraints on optimization

• Communication is integral to execution– Asynchrony is first class

• Promote robustness– Modular– Static allocation– Explicit success/fail at all interfaces– Reuse

• Ease of interpositioning

Page 8: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

8

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 15

Embedded System Design: Hardware Abstraction

• Abstract a hardware unit for convenient software access.

• Datasheet describes set of interfaces (pins, wires, busses) and operations

– Commands that can be asserted or issued to it– Events that it will signal or raise– Interfaces to other hardware units that it is attached to

• Internally the unit has state and computational processes that operate in parallel with other units.

state

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 16

Embedded System Design: Data Acquisition• Configure and command ADC

to sample external I/O attached to sensor.

– Either directly or over a bus protocol• Obtain readings upon

notification by polling or handling interrupts

– One short or periodic• Perform processing on the

readings (smoothing, thresholding, transformation) and possibly signal higher level notification

• Similar for DAC to actuator

ADC

Analogsensor

Digitalsensor

Digital Signal Processing Software

storagethreads

Bus

Page 9: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

9

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 17

Embedded System Design: Protocol Implementation• For

– Bus Protocols within a node, – Link Protocols between two nodes in

direct communication, – Network Protocols between possibly

widely separate node.

• Each has– Set of operations that it issues– Set responses that it receives

» synchronous or asynchronous, – state it maintains, – state-transition diagram that it

implements

• And various commands and events that define its interface above and below

– Exceptions, etc.

Communication Protocol

Stateprocessing

Lower Level of stack

Higher Level of stack

LogicalPeerComm.

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 18

Tiny OS Concepts• System = Scheduler + graph of Components

– Hierarchical• Component:

– Set of bidirectional Command/Event Interfaces– Commands Handlers – Event Handlers– Frame (storage)– Tasks (concurrency)

• Constrained two-level scheduling model – tasks + events

• Constrained Storage Model– frame per component, – Single shared stack, – no heap

• Structured event-driven processing• Very lean multithreading• Efficient Layering

– Events can signal events• Extremely modular construction

– Separates creation and composition of functional elements

ComponentInternal

State

Com

man

ds

Even

ts

interface

Task

Page 10: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

10

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 19

Application = Graph of Components

RFM

Radio byte

Radio Packet

UART

Serial Packet

ADC

Temp photo

Active Messages

clocksbit

byte

pack

et

Route map router sensor appln

appl

icat

ion

HW

SW

Graph of cooperating state machines on shared stackExecution driven by interrupts

* Early TinyOS 0.x component graph going all the way down to modulating the RF channel in software.

Modular construction ofProtocols.

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 20

TOS Execution Model

• commands request action– ack/nack at every boundary– call cmd or post task

• events notify occurrence– HW intrpt at lowest level– may signal events– call cmds– post tasks

• Tasks provide logical concurrency

– preempted by events

• Migration of HW/SW boundary

RFM

Radio byte

Radio Packet

bit

byte

pack

et

event-driven bit-pump

event-driven byte-pump

event-driven packet-pump

message-event drivenactive message

application comp

encode/decode

crc

data processing

Page 11: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

11

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 21

TinyOS Execution Contexts

• Events generated by interrupts preempt tasks• Tasks do not preempt tasks• Both essential process state transitions

Hardware

Interrupts

even

ts

commands

Tasks

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 22

Dynamics of Events and Threads

bit event filtered at byte layer

bit event => end of byte =>

end of packet => end of msg send

thread posted to start

send next message

radio takes clock events to detect recv

Page 12: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

12

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 23

Programming TinyOS - nesC• TinyOS 1.x and TinyOS 2.x are written in an extension of C,

called nesC• Applications are too!

– just additional components composed with the OS components

• Provides syntax for TinyOS concurrency and storage model– commands, events, tasks– local frame variables

• Rich Compositional Support– separation of definition and linkage– robustness through narrow interfaces and reuse– interpositioning

• Whole system analysis and optimization• Platform independent data types and structure

– because packets are sent between different kinds of processors!

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 24

Composition• A component specifies a set of interfaces by

which it is connected to other components– provides a set of interfaces to other components– uses a set of interfaces provided by other components

• Interfaces are bi-directional– include commands and events

• Interface methods form the external namespace of the component

– Composition by “wiring”

Timer Component

StdControl Timer

Clock

provides

uses

provides

interface StdControl;

interface Timer:

uses

interface Clock

Page 13: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

13

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 25

Split-phase abstraction of HW• Command synchronously initiates action• Device operates concurrently• Signals event(s) in response

– ADC– Clock– Send (UART, Radio, …)– Recv – depending on model– Coprocessor

• Higher level (SW) processes don’t wait or poll– Allows automated power management

• Higher level components behave the same way– Tasks provide internal concurrency where there is no explicit hardware

concurrency

• Components (even subtrees) replaced by HW and vice versa

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 26

TASKS• provide concurrency internal to a component

– longer running operations– are preempted by events– able to perform operations beyond event context– may call commands– may signal events– not preempted by tasks

• Simple (pluggable) Scheduler– Composition exercises substantial control over scheduling

{...post TskName();...}

task void TskName {...}

Page 14: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

14

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 27

Typical application use of tasks

• event driven data acquisition• schedule task to do computational portion

event result_t sensor.dataReady(uint16_t data) {

putdata(data);

post processData();

return SUCCESS;

}

task void processData() {

int16_t i, sum=0;

for (i=0; i ‹ maxdata; i++)

sum += (rdata[i] ›› 7);

display(sum ›› shiftdata);

}

• 128 Hz sampling rate• simple FIR filter• dynamic software tuning for centering the magnetometer signal (1208 bytes)

• digital control of analog, not DSP• ADC (196 bytes)

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 28

Tasks in low-level operation• transmit packet

– send command schedules task to calculate CRC– task initiated byte-level data pump– events keep the pump flowing

• receive packet– receive event schedules task to check CRC– task signals packet ready if OK

• i2c component– i2c bus has long suspensive operations– tasks used to create split-phase interface– events can procede during bus transactions

• Timer– Post task in-critical section, signal event when current task complete

Make SW look like HW

Page 15: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

15

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 29

Structured Events vs Multi-tasking• Storage• Control Paradigm

– Always block/yield – rely on thread switching– Never block – rely on event signaling

• Communication & Coordination among potentially parallel activities

– Threads: global variables/mailboxes, mutex, signaling– Preemptive – handle many potential races– Non-premptive

» All interactions protected by costs system synch ops– Events: signaling

• Scheduling:– Complex threads require sophisticating scheduling– Collections of simple events ??

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 30

Modern TinyOS Service Architecture

Net

Pro

g

Hardware

Init/

Boo

t

PersistentAttributes &

Event Streams

DeviceAttributes &

Event Streams

ServiceInterface

Com

man

ds

Attr

ibut

es

Eve

nts

Dis

cove

ry

Mes

sage

s

Man

agem

ent &

Pow

er

Domain-Specific Application Components

OS & Net Interface

Mot

or

Ligh

t

Blo

cks

Vib

ratio

n

Logs

File

s

Network Collection, Dissemination, &

RoutingLinksDevice

AbstractionInterface Flash Radio / Serial Sensor / Actuator

Microcontroller Core, Timers, Buses, Onboard ADCsMicrocontroller

AbstractionInterface

TelosB MicaZ Intel Mote2

Dom

ain-

Spe

cific

Dev

ice

Driv

ers

Page 16: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

16

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 31

TinyOS 2.0 – abstraction architecture

Flexible Hardware Abstraction for Wireless Sensor Networks, Vlado Handziski, Joseph Polastre, Jan-Hinrich Hauer, Cory Sharp, Adam Wolisz, David Culler,In Proceedings of the Second European Workshop on Wireless Sensor Networks (EWSN '05), January 31-February 2, 2005.

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 32

Sample of TinyOS Platforms

Page 17: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

17

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 33

SiliconWorld Storage ProcessingWireless Sensors

WSN mote platform

Wireless Embedded Networks

PhysicalWorld

DigitalWorld Radio

SerialFlash ADC,

Sensor I/FMCU, Timers,

Bus,…

Link

Blocks, Logs, Files

Scheduling, Management

Streaming drivers

Over-the-airProgramming

Applications and Services

NetworkProtocols

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 34

Embedded Networking Requirements

• Reliable Dissemination• Data Collection and Aggregation• Point-to-point Transfers

• Reliably over lossy links• At low power

– Idle listening, management, monitoring

• Adapting to changing conditions• Scalar and Bulk Versions

Page 18: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

18

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 35

Neighbor Communication

0

11

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 36

Multihop Routing

• Upon each transmission, one of the recipients retransmits

– determined by source, by receiver, by …– on the ‘edge of the cell’

Page 19: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

19

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 37

Power to Communicate

0

20

40

60

80

100

120

140

0 1 2 3 4 5

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 38

Route-Free Dissemination

0

11

Page 20: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

20

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 39

Data Collection

0

112

2

2

22

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 40

TinyOS 2x Embedded IP Architecture

GPIO Pins

Ext. INT

ADCSPI, i2c,UART

Low-Power 802.15.4

Virt

ual

ms

Tim

er

μs Timer

RTC

Sch

edul

er

Flas

hS

tora

ge

arbiters

PwrM

gr

UDP/TCP L4 Basic Health &Mgmt Services Basic

ConfigurationServices

Sensor Drivers

OTAIP 6LowPAN L2

IP route L3

Higher Level Embedded Web Services

Page 21: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

21

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 41

Transit Network(IP or not)

Access point- Base station- Proxy

Sensor Patch

Patch Network

Data Service

Intranet/Internet (IP)

Client Data Browsingand Processing

Sensor Node

GatewayGateway

Verification links

Other information sources

Sensor Node

Canonical SensorNet Network Architecture

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 42

Typical IP Network

InternetInternet

ISP

Company Router / Firewall

externallyaccessible hosts

DMZ

WiFiWiFi

Internal Private networks

ethernet

serial linesleased linkspoint-point links

internally accessible hosts

Stand-alone networks

inaccessiblehosts

WiFIWiFI

External networksVPNtunnels

Page 22: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

22

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 43

WSNs in an IP context

InternetInternet

Stand-alone embedded networks

monitoring devices

ad hocembedded

network

controllers& analytics

IP-basedembedded

network

monitoring devices

ad hocembedded

network

controllers& analytics

IP-basedembedded

network

Router /Firewall

gatewaycomputer

IP-basedcorporatenetworks

InternetInternet

IP-basedcorporatenetworks

Internally connected embedded networks

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 44

Router / Gateway Architecture

Gateway Hardware Platform802.15.4ENMC

Linux Kernel (2.4)

serial

AR Router

AR Services

ApplnSpecific

ProcessesBasic AR Services

Just another TinyOSApplication / System“RockBridge”

Page 23: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

23

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 45

TEP - TinyOS Enhancement Proposals• TEP 1: TEP Structure and Key Words

[HTML]• TEP 2: Hardware Abstraction

Architecture [HTML]• TEP 3: Coding Standards [HTML]• TEP 101: ADC [HTML] • TEP 102: Timers [HTML] • TEP 103: Storage [HTML]• TEP 106: Schedulers and Tasks

[HTML]• TEP 107: Boot Sequence [HTML]• TEP 108: Resource Arbitration

[HTML]• TEP 109: Sensorboards [HTML] • TEP 111: message_t [HTML]• TEP 112: Microcontroller Power

Management [HTML]

• TEP 113: Serial Communication [HTML]

• TEP 114: SIDs: Source and Sink Independent Drivers [HTML]

• TEP 115: Power Management of Non-Virtualized Devices [HTML]

• TEP 116: Packet Protocols [HTML] • TEP 117: Low-Level I/O [HTML] • TEP 118: Dissemination [HTML] • TEP 119: Collection [HTML] • TEP 123: Collection Tree Protocol

(CTP) [HTML] • TEP 124: Link Estimation Exchange

Protocol (LEEP) [HTML] • TEP 125: TinyOS 802.15.4 Frames

[HTML] • TEP 126: CC2420 Radio Stack [HTML]

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 46

TinyOS Execution Philosophy• Sleep almost all the time.• Wake-up (quickly) when there is something to do.• Process it and all other concurrent or serial

activities as rapidly as possible.– Structured, event driven concurrency

• Never wait!!!• Automatically go back to sleep

Page 24: Wireless Embedded Systems and Networkingculler/AIIT/print1-lectures/M3... · 1 AIIT Summer Course - M3-TinyOS WSNs 7/9/2007 1 Wireless Embedded Systems and Networking Foundations

24

7/9/2007AIIT Summer Course - M3-TinyOS WSNs 47

TinyOS Structured Design Philosophy• Think hard about components

– Well-define behavior, well-define interfaces

• Compose components into larger components• Flexible structured design of entire system

– And application

• Dealing with distributed system of many resource-constrained devices embedded in hard to reach places and coping with noise, uncertainty and variation.

• Make the node, the network, and the system as robust as possible.

• KEEP IT SIMPLE!