tinyos 2.0 network stack enhancements joseph polastrephil levis uc berkeley uc berkeley moteiv...
TRANSCRIPT
TinyOS 2.0Network Stack Enhancements
Joseph Polastre Phil LevisUC Berkeley UC BerkeleyMoteiv Corporation
2TinyOS Technology Exchange II: 2/11/2005
Need for changes
Cross-platform common radio/MACmicaZ, Telos, imote2…Currently each platform implements routines
for accessing radio and timer Support different TOSMsg structures for
different radios/MACsDifficult to build different underlying MAC and
Radio implementations—CSMA/TDMA/slotted
3TinyOS Technology Exchange II: 2/11/2005
Summary of Changes
New TOSMsg formatDefined by each radio“External types”—network structuresAbstract type—fields provided by components
New Interfaces to AM LayerSupports CSMA and slotting MAC protocols
New Bus Protocol Abstraction
4TinyOS Technology Exchange II: 2/11/2005
TOSMsg
Abstract type defined by each MAC protocol Similar to S-MAC TinyOS implementation
typedef nx_struct TOSMsg { TOSRadioHeader header; nx_uint8_t data[TOSH_DATA_LENGTH]; TOSRadioFooter footer; TOSRadioMetadata metadata;} TOSMsg;
Radio/MAC specific header
Application data payload
Radio/MAC specific footer
Radio/MAC metadatanot sent over the radio
5TinyOS Technology Exchange II: 2/11/2005
Global TOSMsg Fields
Interface RadioPacketLengthAddressGroup/PANDataTimeAcknowledgement
6TinyOS Technology Exchange II: 2/11/2005
Accessing TOSMsg Fields
For Global Fields Platform and MAC independent All MAC required to implement
Wire to RadioC.RadioPacket Access fields through Radio Packet interface
length = call RadioPacket.getLength(msg);
7TinyOS Technology Exchange II: 2/11/2005
Moving up the stack
RadioPacket accesses the lowest primitive fields at the link protocol
AM exports fields throughAMPacket
Likewise, standard MultiHopfields through MultiHopPacket
Provides separation of messagefield implementation and accessto those fields
Radio
AM
MultiHop
8TinyOS Technology Exchange II: 2/11/2005
Accessing TOSMsg Fields
For MAC-dependent applicationsUse structures defined by MAC protocol
Example: CC2420 radio
void myfunc() { if (msg.lqi > 100) { // perform action }}
typedef nx_struct TOSRadioMetadata { nx_uint8_t strength; nx_uint8_t lqi; nx_bool crc; nx_bool ack; nx_uint16_t time;} TOSRadioMetadata;
9TinyOS Technology Exchange II: 2/11/2005
Protocol Bus Abstraction
All protocol busses provide Bus Arbitration SPI, I2C, UART HIL Protocol Access Bus must be acquired before use, even if only a single user Token granted to bus user, all accesses must use token
Bus ArbitrationHIL SPIStdControl
SPICSPI Configuration
10TinyOS Technology Exchange II: 2/11/2005
Component OrganizationExample: CC2420 Radio Stack for Telos
RadioC
CSMARadioC
CC2420RadioM CC2420ControlM
HPLCC2420
HIL SPI
HAL Interrupts & PinsHAL SPI
HPL MCU
Hardware
TelosCC2420
All radios provide
Adds CSMA interfaces
CC2420 Logic
Rd/Wr CC2420 Registers
Wiring to SPI bus/Ints
SPI Bus Interface
MCU Implementation
MCU Registers
MCU & Radio
Platform Independent Platform Specific
Questions?
More information:See TEP 105:“Radio Link Layer”