David Culler, Jason Hill, Robert Szewczyk, Alec Woo U.C. Berkeley 2/9/2001 TinyOS Programming Boot Camp Part IV – Tiny OS 4.3 Component Overview.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

Phil Buonadonna, Jason Hill CS-268, Spring 2000 MOTE Active Messages Communication Architectures for Networked Mini-Devices Networked sub-devicesActive.
A System Architecture for Tiny Networked Devices
Towards System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley.
Computer Architecture
System Integration and Performance
MPI Message Passing Interface
INPUT-OUTPUT ORGANIZATION
NesC: A Programming Language for Motes David Gay, Phil Levis, Eric Brewer, Rob von Behren, Nikita Borisov, Mike Chen, David Culler Intel Research, UC Berkeley.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
DOT3 Radio Stack Sukun KimJaein Jeong A DOT3 Mote Design & Implementation Motivation Evaluation MICA is not enough for large scale applications. DOT3 is.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
7/13/2007AIIT Summer Course - D#1 Wireless Embedded Systems and Networking Lab Day 5: Part 1: TinyOS Programming on Open Source Distribution Jaein Jeong.
COE 342: Data & Computer Communications (T042) Dr. Marwan Abu-Amara Chapter 6: Digital Data Communications Techniques.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
DOT3 Radio Stack Jaein Jeong, Sukun Kim Nest Retreat January 16, 2003.
A System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley 9/22/2000.
1 TinyOS Mohammad Rahimi CSCI599-Spring Motivation  The new class of distributed tiny devices  The new generation of software.
TinyOS Software Engineering Sensor Networks for the Masses.
David Culler, Jason Hill, Robert Szewczyk, and Alec Woo U.C. Berkeley 2/9/2001 TinyOS Programming Boot Camp (V) Communication.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
TOSSIM: Visualizing the Real World Philip Levis, Nelson Lee, Dennis Chi and David Culler UC Berkeley NEST Retreat, January 2003.
Input/Output and Communication
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Layer 2 Switch  Layer 2 Switching is hardware based.  Uses the host's Media Access Control (MAC) address.  Uses Application Specific Integrated Circuits.
INPUT-OUTPUT ORGANIZATION
Connecting LANs, Backbone Networks, and Virtual LANs
Spring 2000, 4/27/00 Power evaluation of SmartDust remote sensors CS 252 Project Presentation Robert Szewczyk Andras Ferencz.
High Speed Digital Design Project SpaceWire Router Student: Asaf Bercovich Instructor: Mony Orbach Semester: Winter 2009/ Semester Project Date:
3/11/2002CSE Input/Output Input/Output Control Datapath Memory Processor Input Output Memory Input Output Network Control Datapath Processor.
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
Project #2 Mobile Multiplayer Game: Tic-Tac-Toe Project #3 TinyOS Sensing Application EE194WIR Matt Magpayo
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
I/O Systems I/O Hardware Application I/O Interface
Internet Addresses. Universal Identifiers Universal Communication Service - Communication system which allows any host to communicate with any other host.
LWIP TCP/IP Stack 김백규.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Chapter 6 – Connectivity Devices
ECS 152A 4. Communications Techniques. Asynchronous and Synchronous Transmission Timing problems require a mechanism to synchronize the transmitter and.
Autonomous Helicopter James LydenEE 496Harris Okazaki.
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
CCNA 3 Week 4 Switching Concepts. Copyright © 2005 University of Bolton Introduction Lan design has moved away from using shared media, hubs and repeaters.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
I/O Computer Organization II 1 Interconnecting Components Need interconnections between – CPU, memory, I/O controllers Bus: shared communication channel.
TinyOS and UC Berkeley Motes Hardware and Programming Tools Some slides and information was taken from Boot1.ppt and Boot2.ppt on the Berkeley TinyOS website.
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
Main Issues Three major issues that we are concerned with in sensor networks are – Clustering Routing and Security To be considered against the backdrop.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Connecting Devices CORPORATE INSTITUTE OF SCIENCE & TECHNOLOGY, BHOPAL Department of Electronics and.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
GBT SCA overview Slide 1-5 Work status Slide 6-10 Shuaib Ahmad Khan.
Linux Operations and Administration Chapter Eight Network Communications.
Active Message Application: CONNECT Presented by Xiaozhou David Zhu Oommen Regi July 6, 2001.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
TinyOS By Valliappan Annamalai. Hardware Mica motes (Mica2 and Mica2Dot) Hardware –Radio –Microcontroller –Flash memory –ADC –Sensor Board (MTA310)
LonWorks Introduction Hwayoung Chae.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
Simulation of Distributed Application and Protocols using TOSSIM
Input/Output and Communication
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

David Culler, Jason Hill, Robert Szewczyk, Alec Woo U.C. Berkeley 2/9/2001 TinyOS Programming Boot Camp Part IV – Tiny OS 4.3 Component Overview

Communication Groupings: ActuatingSensing Communication Application Main Hardware Abstractions

Hardware Abstraction Components LEDs Clock UART ADC RFM

LEDs – LEDS.comp Provides a generic interface to the LED outputs Abstracts away pin numbering and hardware wiring INIT turns off all LEDs Provide on, off, and toggle interface for each LED TOS_MODULE LEDS; ACCEPTS{ char LEDS_INIT(void); char RED_LED_ON(void); char RED_LED_OFF(void); char RED_LED_TOGGLE(void); char GREEN_LED_ON(void); char GREEN_LED_OFF(void); char GREEN_LED_TOGGLE(void); char YELLOW_LED_ON(void); char YELLOW_LED_OFF(void); char YELLOW_LED_TOGGLE(void); };

Timing – CLOCK.comp Generates periodic events to trigger applications Abstracts away counter registers, interrupt masks, and interrupt vectors Initialize with number of ticks between events and scale of the ticks Can use predefined definitions of the form ticksNps All components that connect to the clock event will receive the same event rate Initialization rests counter to zero TOS_MODULE CLOCK; ACCEPTS{ char CLOCK_INIT(char interval, char scale); }; SIGNALS{ void CLOCK_FIRE_EVENT(void); };

Timing (cont.) Example initializations: –CLOCK_INIT(64, 2) or CLOCK_INIT(tick64ps) –Fire every 64 ticks where each tick is 1/4096 seconds, or fire 64 times per second Predefined Intervals tick1000ps, tick100ps tick10ps, tick4096ps tick2048ps, tick1024ps tick512ps, tick256ps tick128ps, tick64ps tick32ps, tick16ps tick8ps, tick4ps tick2ps, tick1ps Scale 0 - OFF ticks/second ticks/second ticks/second ticks/second ticks/second ticks/second ticks/second system/include/hardware.h

UART – UART.comp Abstracts away baud rate control, data transfer registers, interrupt control and data buffering Fires event on RX and TX completion Operates at the byte level TX_READY signals that the component can handle another byte TOS_MODULE UART; ACCEPTS{ char UART_INIT(void); char UART_TX_BYTES(char data); char UART_PWR(char data); }; SIGNALS{ char UART_RX_BYTE_READY(char data, char error); char UART_TX_BYTE_READY(char success); };

ADC – ADC.comp Abstracts away ADC control registers, ADC interrupt handling and sample timing Accepts request for data that contains the port number of the data being requested Fires separate events for each data port – common way of avoiding dynamic dispatching Asynchronous data request, data ready interface TOS_MODULE ADC; ACCEPTS{ char ADC_INIT(void); char ADC_GET_DATA(char port); }; SIGNALS{ char ADC_DATA_READY_PORT_0(int data); char ADC_DATA_READY_PORT_1(int data); char ADC_DATA_READY_PORT_2(int data); char ADC_DATA_READY_PORT_3(int data); char ADC_DATA_READY_PORT_4(int data); char ADC_DATA_READY_PORT_5(int data); char ADC_DATA_READY_PORT_6(int data); char ADC_DATA_READY_PORT_7(int data); };

The sensor stack Photo, and Temperature sensing components Sits on top of ADC component Typical request data, wait for data event paradigm TOS_MODULE PHOTO; JOINTLY IMPLEMENTED_BY PHOTO; ACCEPTS{ char PHOTO_INIT(void); char PHOTO_GET_DATA(void); char PHOTO_PWR(char mode); }; SIGNALS{ char PHOTO_DATA_READY(int data); }; USES{ char SUB_ADC_INIT(void); char SUB_ADC_GET_DATA(char port); }; HANDLES{ char PHOTO_ADC_DONE(int data); }; PHOTO.comp interface PHOTO.c ADC Typical Application

RFM – RFM.comp Bit level interface to the RFM radio Abstracts away bit level timing, RFM specific control logic (TX vs. RX modes) Signals RX and TX bit events RFM_SET_BIT_RATE accepts 3 sampling rates… 0 = 50us (2 x bit rate) 1 = 75us (1.5 x bit rate) 2 = 100us (1x bit rate) 2x Bit rate used for detecting start symbol, bit rate 1.5 x used to transition to middle of bit transmission, 1x bit rate used to read and write data TOS_MODULE RFM; ACCEPTS{ char RFM_INIT(void); char RFM_TX_MODE(void); char RFM_TX_BIT(char data); char RFM_RX_MODE(void); char RFM_PWR(char mode); char RFM_SET_BIT_RATE(char level); }; SIGNALS{ char RFM_TX_BIT_EVENT(void); char RFM_RX_BIT_EVENT(char data); };

The Communications Stack Building up from the RFM bit level Bit level abstracts away radio specifics Byte level radio component collects individual bits into bytes Packet Level constructs packets from bytes Messaging layer interprets packets as messages Data pump paradigm used to connect layers RFM Bit Level Byte Level Packet Level Messaging

Data Pump Paradigm High level components initiate transfer (COMMANDS) Lower level components signal when more data can be handled (EVENTS) Collection of bit events aggregated into single byte event Collection of byte events collected into single packet event RFM Bit Level Byte Level Packet Level …

RFM and RFM_LOW_POWER Two options for bit level components: –RFM and RFM_LOW_POWER RFM low_power –Performs turn off radio when channel is idle –Radio on 1/10 th of the time –When idle, 270us off and 30us on –If transmission detected, it returns to normal mode of operation TOS_MODULE RFM; ACCEPTS{ char RFM_INIT(void); char RFM_TX_MODE(void); char RFM_TX_BIT(char data); char RFM_RX_MODE(void); char RFM_PWR(char mode); char RFM_SET_BIT_RATE(char level); }; SIGNALS{ char RFM_TX_BIT_EVENT(void); char RFM_RX_BIT_EVENT(char data); };

Radio Byte Level RADIO_BYTE.comp, FOUR_B_RADIO_BYTE.comp, SEC_DED_RADIO_BYTE.comp, SEC_DED_RADIO_BYTE_SIGNAL.comp All have similar interfaces Transfer individual bits to the radio Fires off TX_READY event when it can accept another byte TOS_MODULE RADIO_BYTE; ACCEPTS{ char RADIO_BYTE_INIT(void); char RADIO_BYTE_TX_BYTES(char data); char RADIO_BYTE_PWR(char mode); }; SIGNALS{ char RADIO_BYTE_RX_BYTE_READY(char data, char error); char RADIO_BYTE_TX_BYTE_READY(char success); char RADIO_BYTE_TX_DONE(void); };

General Radio Byte Operation Pipelines transmission – transmits single byte while encoding next byte Trades 1 byte of buffering for additional latency Separates high level latencies from low level latency requirements Encoding Task must complete before byte transmission completes Decode must complete before next byte arrives Encode Task Bit transmission Byte 1 Byte 2 RFM Bits Byte 2 Byte 1Byte 3 Byte 4 start …

Radio Byte FSM with Tasks (Sending) 0 2 tx_bytes/POST_TASK 34 tx_bit &~c16 tx_bytes accepted tx_byte_rdy signaled Encode Task Executed 1 tx_bit &c16 / tx_byte_rdy tx_bit &~c16 tx_bit called State Table 0 = idle 1 = waiting to send out first byte 2 = sending out byte, no next byte 3 = sending out byte, waiting to encode next byte 4 = sending out byte, done encoding next byte tx_bytes/POST_TASK tx_bit &~c16 tx_bit &c16 / tx_byte_rdy,tx_done tx_done signaled

Radio Byte FSM with Tasks (Receiving) 0 rx_bit & start frame 6+ 6 rx_bit rx_bit &~start symbol rx_bit &~c16 byte_rdy_evt byte_rdy_evt signaled rx_bit handled Decode Task 5 byte_rdy_evt rx_bit &~c16 State Table 0 = idle 5 = Start Symbol Received 6 = Reading in byte 6+ = Reading in byte, waiting to decode previous rx_bit & c16/POST_TASK

Different Encoding Options RADIO_BYTE.comp –Basic Manchester encoding –Each bit encoded as two bits –0 -> 01, 1 -> 10 –2x overhead, provides no error correction –Does not perform error detection FOUR_B_RADIO_BYTE.comp –Performs 4b/6b, DC balancing encoding –4 bite nibbles transmitted at 6 bits –1.5 x overhead, no error correction possible –Does not perform error detection –Table look-up used to perform encoding

Different Encoding Options (cont.) SEC_DED_RADIO_BYTE.comp »Combination of SEC_DED forward error correction and DC balancing –8 bits encoded as 17 bits –Can correct 1 bit errors and detect two bit errors –Based on binary matrix multiplication SEC_DED_RADIO_BYTE_SIGNAL.comp –Same as SEC_DED_RADIO_BYTE except it also provides the value of the BBOUT pin from the RFM –Each time a 1 bit is read in, the ADC samples the value of the BBOUT pin. The readings are averaged and put into the Byte_Ready event

SEC_DED_BYTE encoding matrix Based on hamming codes Performs both DC_balance and FEC in one step Generator Matrix:

Packet Level Components UART_PACKET.comp, PACKETOBJ.comp, PACKETOBJ_SIGNAL.comp, CRCPACKETOBJ.comp, RED_PACKETOBJ.comp Transfer individual bytes down to byte level components Top of the communications data pumps Deals with fixed length packets Refuses to accept packet if busy TOS_MODULE PACKETOBJ; ACCEPTS{ char PACKET_TX_PACKET( TOS_MsgPtr data); void PACKET_POWER(char mode); char PACKET_INIT(void); }; SIGNALS{ char PACKET_TX_PACKET_DONE( TOS_MsgPtr packet); TOS_MsgPtr PACKET_RX_PACKET_DONE( TOS_MsgPtr packet); };

Packet Options PACKETOBJ.comp –Generic fixed length packets CRCPACKETOBJ.comp –Add a 16 bit CRC check to the end of the packet –Drops packet if CRC check fails RED_PACKET.comp –Redundancy based forward error correction –Each packet is transmitted 3 times –For each byte, if two of the three version match, it accepts the value –Otherwise the first version is used PACKETOBJ_SIGNAL.comp –Designed to work with SED_DED_RADIO_BYTE_SIGNAL.comp –Averages the signal strength readings and places it in the strength variable of the packet –Requires that MSG.h be modified to add the strength field to the end of the packet

Tasks in low-level packet processing char TOS_COMMAND(PACKET_TX_PACKET)(TOS_MsgPtr data){ if(VAR(state) == 0){/* receiving */ VAR(data) = (char*)data; if(TOS_CALL_COMMAND(PACKET_SUB_TX_BYTES)(VAR(data)[0])){ /* start tx */ TOS_POST_TASK(CRC_calc); VAR(state) = 1;/* transmitting */ VAR(count) = 1; return 1; }else{ return 0; } }else{ return 0; } Post task to calculate CRC in the background while event driven data pumps push bytes system/CRC_PACKET_OBJ.c

Messaging Level Components AM.comp, AM_BASE.comp Adds Addressing, Active Message Dispatching, and Group IDs to the communications layer One byte message type used to direct packet to handlers –AM_MSG_HANDLER_0 handles message 0 Buffer Swapping on message receipt 0xff = Broadcast Address AM_BASE sends 0x7E to UART interface TOS_MODULE AM; ACCEPTS{ char AM_SEND_MSG(char addr,char type, TOS_MsgPtr data); char AM_POWER(char mode); char AM_INIT(void); }; SIGNALS{ char AM_MSG_SEND_DONE(TOS_MsgPtr msg); TOS_MsgPtr AM_MSG_HANDLER_0(TOS_MsgPtr data); TOS_MsgPtr AM_MSG_HANDLER_1(TOS_MsgPtr data);. TOS_MsgPtr AM_MSG_HANDLER_255(TOS_MsgPtr data); };

Messaging Format Set in system/include/MSG.h Data structure needs to be modified to account for the packet layer used Packet layers use sizeof(MSG_VALS) to set transmission size struct MSG_VALS{ char addr; char type; char group; char data[DATA_LENGTH]; //short crc; //int strength; }; system/include/MSG.h

Communications Packages: GENERIC_COMM.comp –Contains AM, PACKETOBJ, SEC_DED_RADIO_BYTE and RFM BASE_COMM.comp –Contains AM_BASE, PACKETOBJ, SEC_DED_RADIO_BYTE, RFM, UART_PACKET and UART CRC_COMM.comp –Contains AM, CRCPACKETOBJ, FOUR_B_RADIO_BYTE and RFM

Full PC support of communication Hardware abstraction components modified to work on PCs RFM and UART replaced by sockets Each individual radio bit is sent as a character over a socket RFM connects to :9876 UART connects to :8765 Implemented in: –system/include/Fullpc_radio.h –system/include/Fullpc_uart_connect.h RF_simulator used to simulate connectivity

RF_Simulator Connects individual Mote processes together By default, nodes 1->10 are fully connected –Edit RF_simulator/ConnectionManager.java to change topology Can construct arbitrary topologies of connectivity add_conn(ID1, ID2) creates a bi-directional link between mote with ID1 and ID2 RF_simulator/ConnectionManager.java add_conn(1, 2); add_conn(2, 3); add_conn(3, 4); add_conn(4, 2);

Example use of RF_simulator 1.Compile CNT_TO_RFM.decs for the PC Copy main.exe to counter.exe 2.Compile generic_base.desc for the PC 3.Open three console windows 1.In the first, cd RF_simulator; java ConnectionManager 2.In the second, run main 5 3.In the third, run counter 3 4.You will see packets transmitted by counter, forwarded by the connection manager and received by the generic_base 5.The generic base will then send the packet out the UART

Other System Components MAIN I2C_OBJ LOGGER

MAIN.comp Issues INIT and Start command to applications Required to be in all applications Actually calls and includes the scheduler Should not need to be modified TOS_MODULE MAIN USES{ char MAIN_SUB_INIT(void); char MAIN_SUB_START(void); };

I2C_OBJ.comp Implementation of I2C protocol on I2C bus 2 Single Master Only Transmissions take place inside individual tasks Used to interact with EEPROM or external digital sensors Uses tasks to implement split phase protocol ACCEPTS{ char I2C_init(void); char I2C_read(void); char I2C_write(char val); char I2C_send_start(void); char I2C_send_end(void); }; SIGNALS{ char I2C_read_done(char val, char error); char I2C_write_done(char success); char I2C_send_start_done(void); char I2C_send_end_done(void); };

Logger Uses on-board I2C based EEPROM to store log entries Has 30 byte log entries Append Only Log Currently starts over at 0 when initialized ACCEPTS{ char APPEND_LOG(char* data); char READ_LOG(int line, char* dest); char LOGGER_INIT(void); }; SIGNALS{ char APPEND_LOG_DONE(char success); char READ_LOG_DONE(char* packet, char success); };

Application Level Components AM_BEACON.comp –Sends out periodic beacons that contain the local address AM_ECHO.comp –Responds to a message by sending out a message to the address specified by data[0] AM_ROUTE.comp –Ad-hoc routing application that sends collected data to a base station BLINK.comp –Blinks the LEDS CHIRP.comp –Repeatedly sends out packets that contain light sensor readings

Application Level Components (cont.) CONNECT.comp –Ad-hoc routing application that maintains the connectivity graph of which surrounding nodes can be heard COUNTER.comp –Sends the value of the counter to an output device (leds or RFM) SENS_OUTPUT.comp –Send the value of a sensor to an output device GENERIC_BASE.comp –Listens on the RADIO and forwards any packets received to the UART

Application Level Components (cont.) INTERP.comp –Virtual machine for programming the motes LOGGER_TEST.comp –Demonstrations of the Logger functionality. It takes periodic sensor readings and records them to the log. It also sends the values to the UART. It will respond to active messages that request log entries to be read MAGS.comp –Reads data from the ADC and forwards it to the UART. It performs band pass filtering on the data for event detection. Data readings are double buffered WAVE.comp –Changes the values displayed on the LEDs based on the value read from PHOTO.comp