IEEE 802.15.4 MAC and PHY Specifications for LRWPANs 長庚大學資訊工程學系 陳仁暉 助理教授 Tel: (03) 211-8800 Ext: 5990 Email: jhchen@mail.cgu.edu.tw URL: http://www.csie.cgu.edu.tw/~jhchen All rights reserved. No part of this publication and file may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without prior written permission of Professor Jenhui Chen (E-mail: jhchen@mail.cgu.edu.tw). CGU NDSL LR-WPAN - 1 Outline 1. IEEE 802.15.4 Architecture and Overview 2. IEEE 802.15.4 PHY 3. IEEE 802.15.4 MAC CGU NDSL LR-WPAN - 2 1. 802.15.4 Architecture and Overview CGU NDSL LR-WPAN - 3 IEEE Project 802 Standards WLAN WPAN WMAN LR-WPAN CGU NDSL LR-WPAN - 4 IEEE 802.15 Working Group CGU NDSL LR-WPAN - 5 Applications • • • • • • • • Sensors & actuators Interactive toys Smart badges Health monitoring Computing peripherals Remote control Home Automation Automatic Meter Reading CGU NDSL LR-WPAN - 6 New Trend of Wireless Technology • Most Wireless industry focus on increasing high data throughput • A set of applications requiring simple wireless connectivity, relaxed throughput, very low power, short distance and inexpensive – – – – – Industrial Agricultural Vehicular Residential Medical CGU NDSL LR-WPAN - 7 Wireless Markets HI-FI AUDIO STREAMING VIDEO > LONG TEXT GRAPHICS INTERNET MULTI-CHANNEL VIDEO LAN RANGE 802.11b 802.11a/HL2 & 802.11g Bluetooth 2 < SHORT DIGITAL VIDEO ZigBee PAN Bluetooth1 LOW < DATA RATE > HIGH Reference from ZigBee Alliance Inc. CGU NDSL LR-WPAN - 8 Wireless Technologies Range Meters GSM GPRS EDGE 3G 2000 2003-4 10,000 2005 1,000 802.11b 802.11a/g ZigBee 100 Bluetooth 2.0 Bluetooth 10 100 WiMedia Bluetooth 1.5 10 1,000 Hiper LAN/2 10,000 Bandwidth kbps 100,000 Reference from ZigBee Alliance Inc. CGU NDSL LR-WPAN - 9 WLAN vs WPAN CGU NDSL LR-WPAN - 10 Wireless Applications monitors sensors automation control monitors diagnostics sensors INDUSTRIAL & COMMERCIAL CONSUMER ELECTRONICS TV VCR DVD/CD remote ZigBee PERSONAL HEALTH CARE consoles portables educational LOW DATA-RATE RADIO DEVICES TOYS & GAMES HOME AUTOMATION PC & PERIPHERALS mouse keyboard joystick security HVAC lighting closures Reference from ZigBee Alliance Inc. CGU NDSL LR-WPAN - 11 Architecture APPLICATION ZIGBEE STACK SILICON • ZigBee Alliance – 45+ companies: semiconductor mfrs, IP providers, OEMs, etc. Customer – Defining upper layers of protocol stack: from network to application, including application profiles ZigBee Alliance – First profiles published mid 2003 IEEE 802.15.4 • IEEE 802.15.4 Working Group – Defining lower layers of protocol stack: MAC and PHY – draft D18 (will be finalized 2003) CGU NDSL LR-WPAN - 12 What is unique about wireless PAN (WPAN)? • Wireless Personal Area Networks (WPANs) – – – – – short distance small (ultra low complexity) low duty-cycle (<0.1%) power efficient (the most important factor) inexpensive (ultra low cost) solutions. • Typically operating in the Personal Operating Space (POS) of 10 meters. • Supporting star and peer-to-peer topologies – controlled by the PAN coordinator CGU NDSL LR-WPAN - 13 WPAN Features • Media access is contention based. – Using carrier sense multiple access with collision avoidance (CSMA/CA) MAC protocol – Similar to IEEE 802.11 CSMA/CA protocol, but not the same • Provide the optional Superframe structure – The PAN coordinator periodically allocates guaranteed time slots (GTS) to low latency devices • Dynamic device addressing – Two kinds of address of a device – – • 16-bit Short Address 64-bit Extended Address Fully acknowledged protocol for transfer reliability. CGU NDSL LR-WPAN - 14 Device Classes in WPAN • There are two different device types : – A full function device (FFD) – A reduced function device (RFD) • The FFD can operate in three modes serving – Device – Coordinator – PAN coordinator • The RFD can only operate in a mode serving: – Device • Coordinator provides synchronization information to other devices CGU NDSL LR-WPAN - 15 FFD vs RFD • Full function device (FFD) – Any topology – Network coordinator capable – Talks to any other device • Reduced function device (RFD) – Limited to star topology – Cannot become a network coordinator – Talks only to a network coordinator – Very simple implementation CGU NDSL LR-WPAN - 16 Network Topologies • Star and Peer2Peer Topologies CGU NDSL LR-WPAN - 17 Network Topologies • Star network formation: – An FFD may establish its own network and become the PAN coordinator. – All star networks operate independently. – Choosing a PAN identifier, which is not currently used by any other network within the radio sphere of influence. – Both FFDs and RFDs may join the network. • Peer-to-peer network formation: – Each device is capable of communicating with any other device. – One FFD device will be nominated as the PAN coordinator. CGU NDSL LR-WPAN - 18 Star Topology • Home Application FFD RFD FFD PAN coordinator RFD RFD RFD FFD CGU NDSL LR-WPAN - 19 Cluster Tree Topology • Only one PAN coordinator • No detail yet Cluster Head PAN coordinator CGU NDSL LR-WPAN - 20 Cluster Tree Establishment • The PAN coordinator forms the first cluster by establishing itself as the cluster head (CLH) with a cluster identifier (CID) of zero. • Choosing an unused PAN identifier (PANID) and broadcasting beacon frames to neighboring devices. • A candidate device receiving a beacon frame may request to join the network at the CLH. • If the PAN coordinator permits the device, it will add the new device as a child device in its Access Control List (ACL). • The newly joined device will add the CLH as its parent in its ACL, and begin transmitting periodic beacons. • Other candidate devices may then join the network at that device. A larger network (PAN) is possible by forming a mesh of multiple neighboring clusters. • The PAN coordinator may instruct a device to become the CLH of a new cluster adjacent to the first one. • Other devices gradually connect and form a multi-cluster network structure. CGU NDSL LR-WPAN - 21 WPAN Addressing Methods • Two or more devices with a POS communicating on the same physical channel constitute a WPAN which includes at least one FFD (PAN coordinator) • Each independent PAN will select a unique PAN identifier • All devices operating on a network shall have unique 64-bit extended address. This address can be used for direct communication in the PAN • The address can use a 16-bit short address, which is allocated by the PAN coordinator when the device associates • Addressing modes: – Network + device identifier (star) – Source/destination identifier (peer-peer) – Source/destination cluster tree + device identifier (cluster tree) CGU NDSL LR-WPAN - 22 MAC/PHY Functions • Functions in PHY sublayer – – – – – activation and deactivation of the radio transceiver energy detection link quality indication clear channel assessment (CCA) - carrier sense transmitting/receiving bit stream • Functions in MAC sublayer – – – – – – – – beacon management channel access (slotted or unslotted CSMA/CA) guarantee time slot management (QoS) frame validation acknowledged frame delivery association disassociation security mechanisms (AES) CGU NDSL LR-WPAN - 23 2. 802.15.4 Physical Layer CGU NDSL LR-WPAN - 24 PHY Specifications • The standard specifies two PHYs : – 868 MHz/915 MHz direct sequence spread spectrum (DSSS) PHY (11 channels) » 1 channel (20Kb/s) in European 868MHz band » 10 channels (40Kb/s) in 915 (902-928)MHz ISM band – 2450 MHz direct sequence spread spectrum (DSSS) PHY (16 channels) » 16 channels (250Kb/s) in 2.4GHz band CGU NDSL LR-WPAN - 25 PHY Specification • PHY functionalities: – Activation and deactivation of the radio transceiver – Energy detection within the current channel – Link quality indication for received packets – Clear channel assessment for CSMA-CA – Channel frequency selection – Data transmission and reception CGU NDSL LR-WPAN - 26 PHY Specification CGU NDSL LR-WPAN - 27 Operating Frequency Range BAND 2.4 GHz ISM 868 MHz 915 MHz ISM COVERAGE DATA RATE CHANNEL(S) Worldwide 250 kbps 16 Europe 20 kbps 1 Americas 40 kbps 10 • A total of 27 channels, numbered 0 to 26, are available across the three frequency bands. • 16 channels are for 2450 MHz, 10 are for 915 MHz an 1 is for 868 MHz. CGU NDSL LR-WPAN - 28 PHY Parameters • Transmit Power – Capable of at least 1 mW – Power reduction capability required if > 16 dBm (reduce to < 4 dBm in single step) • Transmit Center Frequency Tolerance – 40 ppm • Receiver Sensitivity – -85dBm (2450 MHz) – -92dBm (868/915 MHz) – 1% Packet Error Rate in PSDU = 20 Bytes) • RSSI Measurements – Packet strength indication – Clear channel assessment – Dynamic channel selection CGU NDSL LR-WPAN - 29 Receiver jamming resistance • In 915MHz and 2450MHz bands • The adjacent channel is one on either side of the desired channel that is closest in frequency to the desired channel, and the alternate channel is one more removed from the adjacent channel. (in 915MHz and 2450MHz) – For example, for channel 3, channels 2 and 4 are adjacent channels, and channels 1 and 5 are alternative channels CGU NDSL LR-WPAN - 30 PHY PDU Format (PPDU) • PHY Packet Fields – A synchronization header » Preamble (32 bits) – 32 binary zeros used for synchronization » Start of Packet Delimiter (8 bits) – 10100111 – A PHY header » PHY Header (8 bits) – 7-bit frame length (0-127) and 1-bit reserved – A payload » PSDU (0 to 127 bytes) – Data field 4 Bytes 1 Byte 1 Byte Preamble Start of Packet Delimiter PHY Header 6 Bytes PHY Service Data Unit (PSDU) 0-127 Bytes CGU NDSL LR-WPAN - 31 PPDU Format Length • Frame Length Values – aMaxPHYPacketSize : 127 – aTurnaroundTime : 12 symbol periods CGU NDSL LR-WPAN - 32 2450 MHz PHY Specifications • Data rate: 250 kb/s per channel • Employing a 16-ary quasi-orthogonal modulation technique • During each data symbol period, 4 information bits (symbol) are used to select one of 16 nearly-orthogonal PN sequences (32 chips) to be transmitted • The aggregate chip sequence is modulated onto the carrier using O-QPSK (offset quadrature phase shift keying) (b3b2b1b0) (b7b6b5b4) 2Mchips/s 250kb/s b7b6b5b4b3b2b1b0 2Mhz 4:1 1:32 1:1 (1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0) 62.5ksymbols/s CGU NDSL LR-WPAN - 33 2450 MHz PHY Specifications • Modulation Scheme – Even chips: In-phase (I) carrier – Odd chips: quadrature-phase (Q) carrier – The chip rate (nominally 2.0 Mchip/s) is 32 times the symbol rate (62.5 ksymbols/s) – Data rate : 4 bits/symbol times 62.5 ksymbols/s = 250Kb/s O-QPSK chip offsets CGU NDSL LR-WPAN - 34 2450 MHz PHY Specifications • OQPSK modulation – Tc is the inverse of the chip rate. Example baseband chip sequences with pulse shaping CGU NDSL LR-WPAN - 35 868/915 MHz Band PHY Specifications • Employing DSSS with – binary phase shift keying (BPSK) with raised cosine pulse shaping (rolloff factor = 1) used for chip modulation – differential encoding used for data symbol encoding. » Differential encoding is the modulo-2 addition of a raw data bit (R) with the previous encoded bit (E), where E0 is 0. » Transmitter : » Receiver : 20kb/s 40kb/s 1:1 1:15 20ksymbols/s 40ksymbols/s 1:1 300kchips/s 600kchips/s 300khz 600khz CGU NDSL LR-WPAN - 36 868/915 MHz Band PHY Specifications • Symbol-to-chip mapping • Pulse shape – raised cosine pulse shape (rolloff factor = 1) used to represent each baseband chip CGU NDSL LR-WPAN - 37 General Radio Specifications • Error vector magnitude definition: – The modulation accuracy of a transmitter is determined with an error-vector magnitude (EVM) measurement : N received complex chip values : ideal position of the chosen complex : error vector where S is the magnitude of the vector to the ideal constellation point – A compliant transmitter shall have EVM values of less than 35% when measured for 1000 chips. CGU NDSL LR-WPAN - 38 RED and LQI • Receiver energy detection – The energy detection time shall be equal to 8 symbol periods – an 8-bit integer ranging from 0x00 to 0xff » The minimum ED value (0) shall indicate received power less than 10 dB above the specified receiver sensitivity and the range of received power spanned by the ED values shall be at least 40 dB. Within this range the mapping from the received power in dB to ED value shall be linear with an accuracy of +/6 dB. • Link quality indication (LQI) – may be implemented using receiver energy detection, a signal-to-noise ratio estimation, or a combination of these. – an 8-bit integer ranging from 0x00 to 0xff » At least 8 unique values of LQ shall be used. CGU NDSL LR-WPAN - 39 Clear Channel Assessment (CCA) • Three CCA modes in IEEE 802.15.4 – CCA Mode 1: Energy above threshold. CCA shall report a busy medium upon detecting any energy above the ED threshold. – CCA Mode 2: Carrier sense only. CCA shall report a busy medium only upon the detection of a signal with the modulation and spreading characteristics of IEEE 802.15.4. This signal may be above or below the ED threshold. – CCA Mode 3: Carrier sense with energy above threshold. CCA shall report a busy medium only upon the detection of a signal with the modulation and spreading characteristics of IEEE 802.15.4 with energy above the ED threshold CGU NDSL LR-WPAN - 40 3. 802.15.4 MAC Layer CGU NDSL LR-WPAN - 41 Protocol Layer APPLICATIONS Customer APPLICATION INTERFACE SECURITY NETWORK LAYER Star/Cluster/Mesh DATA LINK LAYER MAC LAYER MAC LAYER PHY LAYER 2.4 GHz 915MHz ZigBee Alliance IEEE 802.15.4 868 MHz Application ZigBee Stack Silicon CGU NDSL LR-WPAN - 42 IEEE 802.15.4 feature • Extremely low cost • Ease of installation • Reliable data transfer • Short range operation • Reasonable battery life Simple but flexible flexible protocol CGU NDSL LR-WPAN - 43 Network Topologies • Star Topology – • In star topology, data may be exchanged only between the coordinator (FFD) and a device (FFD or RFD). Peer-Peer Topology – In a peer-to-peer topology,data may be exchanged between any two devices (FFDs). CGU NDSL LR-WPAN - 44 Star Topology Network coordinator Master/slave Full Function Device (FFD) Reduced Function Device (RFD) Communications Flow CGU NDSL LR-WPAN - 45 Peer-Peer Topology Point to point Tree Full Function Device (FFD) Communications Flow CGU NDSL LR-WPAN - 46 Combined Topology (Cluster Star) Room 3 Room 4 Room 2 Room 1 Full Function Device (FFD) Reduced Function Device (RFD) Star Communications Flow Peer2Peer Communications Flow CGU NDSL LR-WPAN - 47 Device Addressing • All devices have IEEE addresses (64-bits) • Short addresses (16-bit) can be allocated • Addressing modes: – Network + device identifier (star) – Source/destination identifier (peer-peer) – Source/destination cluster tree + device identifier (cluster tree) CGU NDSL LR-WPAN - 48 General Frame Structure • Four Types of Frames Structure: – Beacon Frame - used by coordinator – Data Frame - used for all transfers of data – Acknowledgment Frame - used for confirming successful frame reception – MAC Command Frame - used for handling all MAC peer entity control transfers CGU NDSL LR-WPAN - 49 Superframe Structure • The LR-WPAN allows the optional use of a superframe structure. • The format of the superframe is defined by the coordinator. • The superframe is bounded by network beacons, is sent by the coordinator and is divided into 16 equally sized slots. • The beacon frame is transmitted in the first slot of each superframe. • If a coordinator does not wish to use a superframe structure it may turn off the beacon transmissions. • The beacons are used to synchronize the attached devices, to identify the PAN, and to describe the structure of the superframes. • Any device wishing to communicate during the contention access period (CAP) between two beacons shall compete with other devices using a slotted CSMA-CA mechanism. • All transactions shall be completed by the time of the next network beacon. CGU NDSL LR-WPAN - 50 Superframe Structure • The superframe can have an active and an inactive portion. During the inactive portion the PAN enters a low power mode. • The PAN coordinator may dedicate portions of the active superframe to some devices/applications. These portions are called guaranteed time slots (GTSs). • The GTSs comprise the contention free period (CFP). • The PAN coordinator may allocate up to 7 of these GTSs and a GTS may occupy more than one slot period. (Note:all slots may be allocated for CFP.) • All contention based transactions shall be complete before the CFP begins. Also each device transmitting in a GTS shall ensure that its transaction is complete before the time of the next GTS or the end of the CFP. CGU NDSL LR-WPAN - 51 Superframe Structure • The structure of this superframe is described by the values of macBeaconOrder (BO) and macSuperframeOrder (SO). – The macBeaconOrder describes the interval at which the coordinator shall transmit its beacon frames. – The macSuperframeOrder describes the length of the active portion of the superframe, which includes the beacon frame. CGU NDSL LR-WPAN - 52 Superframe Structure • The values of BO and the beacon interval (BI) are related as follows: BI = aBaseSuperframeDuration 2BO symbols, if 0BO14 • The values of SO and the superframe duration (SD) are related as follows: SD = aBaseSuperframeDuration 2SO symbols, if 0SOBO14 • Note : If BO = 15, the coordinator will not transmit beacon and the value of SO shall be ignored. (non beacon-enable network) Moreover, macRxOnWhenIdle defines whether the receiver is enabled during periods of transceiver inactivity (default : FALSE) • If SO = 15, the superframe will not be active after the beacon. • PANs that wish to use the superframe structure shall set 0SOBO14. CGU NDSL LR-WPAN - 53 Superframe Structure • The active portion of each superframe shall be divided into aNumSuperframeSlots equally spaced slots of duration 2SO *aBaseSlotDuration – aNumSuperframeSlots =16 (Fixed) – aBaseSlotDuration = 2SO 60 symbols (Variable) – aBaseSuperframeDuration = aNumSuperframeSlots aBaseSlotDuration = 16 2SO 60 symbols (Variable) • The active portion is composed of three parts: 1. a beacon (with extended payload) 2. a contention access period (CAP) and 3. a contention free period (CFP). CGU NDSL LR-WPAN - 54 Data Transfer Model There are three types of data transfer transactions. 1) Device -> Coordinator 2) Coordinator -> Device 3) Device (coordinator) -> Device (coordinator) CGU NDSL LR-WPAN - 55 MAC Specifications • Superframe Structure – Optional (named as beacon-enable network) – The format of the superframe is define by the PAN coordinator – Bounded by network beacons and sent by the PAN coordinator – Divided into 16 equally sized slots and beacon is transmitted in the first slot – It consists of two periods » Contention Access Period (CAP) » Contention Free Period (CFP) – Objects of the beacons » synchronize » identify the PAN » describe the structure of the superframes CGU NDSL LR-WPAN - 56 MAC Specifications • The superframe can have an active and an inactive portion. • • • • • • During the inactive portion the coordinator shall not interact with its PAN and may enter a low power mode. The PAN coordinator may allocate portions of the active superframe to some applications and these portions are called guaranteed time slots (GTSs). The GTSs comprise the contention free period (CFP). The PAN coordinator may allocate up to 7 GTSs at the same time A GTS may occupy more than one slot period A sufficient portion of the CAP shall remain for contention. CGU NDSL LR-WPAN - 57 MAC Specifications • Any device wishing to communicate during the CAP between two beacons shall compete with other devices using a slotted CSMA-CA mechanism. • All transactions shall be completed by the time of the next network beacon • If the coordinator does not wish to use a superframe structure, it can turn off the beacon transmissions – named as non beacon-enable network – Using Unslotted CSMA/CA CGU NDSL LR-WPAN - 58 Superframe Structure CGU NDSL LR-WPAN - 59 General Frame Format PHY Layer MAC Layer Payload Synch. Header (SHR) PHY Header (PHR) MAC Header (MHR) MAC Service Data Unit (MSDU) MAC Footer (MFR) MAC Protocol Data Unit (MPDU) PHY Service Data Unit (PSDU) • Four Types of Frames Structure: • Beacon Frame - used by coordinator • Data Frame - used for all transfers of data • Acknowledgment Frame - used for confirming successful frame reception • MAC Command Frame - used for handling all MAC peer entity control transfers CGU NDSL LR-WPAN - 60 Beacon Frame Format (1/4) CGU NDSL LR-WPAN - 61 Data Frame Format (2/4) CGU NDSL LR-WPAN - 62 Acknowledgement Frame Format (3/4) CGU NDSL LR-WPAN - 63 MAC Command Frame Format (4/4) CGU NDSL LR-WPAN - 64 CSMA/CA Mechanism (1/3) • unslotted CSMA/CA: – A device waits for a random period without carrier sense. – If the channel is idle, following the random backoff, it transmits its data. Otherwise, it waits for another random period before retry. • slotted CSMA/CA: – It is similar to the unslotted CSMA/CA but follows the backoff slot boundary.The backoff slots are aligned with the start of the beacon transmission. CGU NDSL LR-WPAN - 65 CSMA/CA Mechanism (2/3) • Frame Acknowledgment – If the originator does not receive an ACK after some period. It will retry the frame transmission. If an ACK is still not received after several retries, the originator can choose either to terminate or to try again. • Power Consumption Considerations – Battery powerd devices will require duty-cycling to reduce power consumption. These devices will spend most of their operational life in a sleep state. They shall periodically listen to the RF channel to determine whether a message is pending. CGU NDSL LR-WPAN - 66 Security (1/2) • Security implementation in the MAC sublayer – maintain an access control list (ACL) – use symmetric cryptography to protect transmitted frames. – The higher layers determine when security is to be used at the MAC sublayer, provide all keying material, Key management, device authentication and freshness protection. • Security modes – Unsecured mode – ACL mode – Secured mode » » » » Access control (protect STA from being attacked, needs ACL) Data encryption (protect data from being resolved) Frame integrity (protect data from being modified) Sequential freshness (protect data from being replayed) CGU NDSL LR-WPAN - 67 Data Transmissions (1) Data transferred from device to coordinator – In a beacon-enable network, device finds the beacon to synchronize to the superframe structure. Then using slotted CSMA/CA to transmit its data. – In a non beacon-enable network, device simply transmits its data using unslotted CSMA/CA Communication to a coordinator In a beacon-enabled network Communication to a coordinator In a non beacon-enabled network CGU NDSL LR-WPAN - 68 Data Transmissions (2) Data transferred from coordinator to device – In a beacon-enable network, the coordinator indicates in the beacon that the data is pending. Device periodically listens to the beacon and transmits a MAC command request using slotted CSMA/CA if necessary. – In a non beacon-enable network, a device transmits a MAC command request using unslotted CSMA/CA. If the coordinator has its pending data, the coordinator transmits data frame using unslotted CSMA/CA. Otherwise, coordinator transmits a data frame with zero length payload. CGU NDSL LR-WPAN - 69 Data Transmissions (Indirect mode) • indirect transmission pending list Communication from a coordinator in a non beacon-enabled network Communication from a coordinator In a beacon-enabled network CGU NDSL LR-WPAN - 70 Indirect transmissions • Since the standard favors very low cost devices that, in general, will be battery powered, transactions can be instigated from the devices themselves rather than from the coordinator. – either coordinator indicates in its beacon when messages are pending for devices – or devices polls the coordinator to determine if they have any messages pending. – Such transfers are called indirect transmissions. • For each transaction sent, if another exists for the same device, the coordinator sets its frame pending subfield to 1, indicating the additional pending data. – Like ‘more data’ flag used in IEEE 802.11 CGU NDSL LR-WPAN - 71 Pending Address Field maximal 7 addresses Beacon Frame CGU NDSL LR-WPAN - 72 Message sequence chart macAckWaitDuration macAckWaitDuration CGU NDSL LR-WPAN - 73 Extracting pending data • The transmits beacons include the pending address lists – The maximal number of addresses in pending list is 7. • If the coordinator has enough time to determine whether the device has a frame pending and is still able to send the ACK frame within macAckWaitDuration symbols, – it sets the actual frame pending subfield of the ACK frame. – Otherwise, the coordinator set the frame pending subfield of the ACK frame to 1 (i.e., announce first) » If there is no pending data, coordinator will send a data frame containing 0 length payload to device, and without requesting ACK » Drawback : waste device’s power • macAckWaitDuration is set as – 120 symbols, if 0 channel 10 (868/915MHz) – 54 symbols, if 11 channel 26 (2.4GHz) CGU NDSL LR-WPAN - 74 Data Service Recipient MAC Originator MAC MCPS-DATA.request Originator Recipient Channel access Data frame Acknowledgement (if requested) MCPS-DATA.indication MCPS-DATA.confirm CGU NDSL LR-WPAN - 75 Peer-to-Peer Data Transfers • In order to do this effectively, the devices wishing to communicate will either need to be receiving constantly or they will need to synchronize with each other. • In the former case, the device can simply transmit its data using unslotted CSMA-CA. In the latter case, other measures need to be taken in order to achieve synchronization. CGU NDSL LR-WPAN - 76 Contention access period (CAP) • The CAP shall be at least aMinCAPLength (=440) symbols, unless additional space is needed to temporarily accommodate – the beacon frame length needed to perform GTS maintenance – the size of the CFP • MAC command frames shall always be transmitted in the CAP CGU NDSL LR-WPAN - 77 Frame Types CGU NDSL LR-WPAN - 78 MAC command frames CGU NDSL LR-WPAN - 79 Inter-frame spacing • The MAC sublayer needs a finite amount of time to process data received by the PHY layer. – Needs inter-frame spacing (IFS) period. • The length of the IFS period is dependent on the size of the frame that has just been transmitted. – Frames (MPDUs) of up to aMaxSIFSFrameSize (=18 octets) shall be followed by a short inter-frame spacing (SIFS) period » The SIFS duration aMinSIFSPeriod (=12) symbols – Frames (MPDUs) with lengths greater than aMaxSIFSFrameSize shall be followed by a long inter-frame spacing (LIFS) » The LIFS duration aMinLIFSPeriod (=40) symbols CGU NDSL LR-WPAN - 80 Inter-frame spacing CGU NDSL LR-WPAN - 81 CSMA-CA Algorithm • The LR-WPAN uses two types of channel access mechanism, depending on the network configuration. 1. Non beacon-enabled networks use an unslotted CSMA-CA channel access mechanism. 2. Beacon-enabled networks use a slotted CSMA-CA channel access mechanism. In both cases, the algorithm is implemented using units of time called backoff periods, where one backoff period shall be equal to aUnitBackoffPeriod (=20) symbols. CGU NDSL LR-WPAN - 82 CSMA-CA Algorithm • In slotted CSMA-CA, the backoff period boundaries shall be aligned with the superframe slot boundaries – the start of the first backoff period of each device is aligned with the start of the beacon transmission. • In unslotted CSMA-CA, the backoff periods of one device are not related in time to the backoff periods of any other device in the PAN. • The CSMA-CA algorithm shall not be used for the transmission of – beacon frames – acknowledgement frames – data frames transmitted in the CFP. CGU NDSL LR-WPAN - 83 CSMA-CA Algorithm • Each device shall maintain three variables for each transmission attempt: – NB (no. of backoff – also known as retry count) (4) – CW (contention window size, perform PHY CCA) – BE (backoff exponent) • NB is the number of times the CSMA-CA algorithm was required to backoff while attempting the current transmission; this value shall be initialized to 0 before each new transmission attempt. • CW is the contention window length, defining the number of backoff periods that need to be clear of channel activity before the transmission can commence; this value shall be initialized to 2 before each transmission attempt. The CW variable is only used for slotted CSMA-CA. • BE is the backoff exponent which is related to how many backoff periods a device shall wait before attempting to assess a channel. CGU NDSL LR-WPAN - 84 CSMA-CA Algorithm • macBattLifeExt flag : This indicates whether battery life extension, by reduction of coordinator receiver operation time during the CAP, is enabled. (default : FALSE) – macBattLifeExtPeriods : the number of backoff periods during which the receiver is enabled following a beacon in battery life extension mode. (active shorter and sleep more) » This value is dependent on the currently selected logical channel » For phyCurrentChannel (0-10), this value is equal to 8. » For phyCurrentChannel (11-26), this value is equal to 6. • macMinBE value : The minimum value of the backoff exponent in the CSMA-CA algorithm. – If this value is set to 0, collision avoidance is disabled during the first iteration of the algorithm. – Values :0-3 (default : 3) • aMaxBE value : The maximum value of the backoff exponent in the CSMA-CA algorithm. – Value = 5 (that is, max 32 backoff slots) CGU NDSL LR-WPAN - 85 The CSMA-CA algorithm • In unslotted systems, or slotted systems with macBattLifeExt set to FALSE, – BE = macMinBE (=3 default) • In slotted systems with macBattLifeExt set to TRUE, this value shall be initialized to – BE = min(2, macMinBE) • For each transmission, the MAC delay for a random number of backoff periods in the range [0,2BE-1] • If the number of backoff periods is greater than the remaining number of backoff periods in the CAP, the MAC shall pause the backoff countdown at the end of the CAP and resume it at the start of the CAP in the next superframe. • As backoff time is up, the PHY perform a clear channel assessment (CCA) twice since CW=2 CGU NDSL LR-WPAN - 86 Flow Chart CGU NDSL LR-WPAN - 87 Channel Scan • Four channel scans – – – – Active scan Passive scan Orphan scan Energy detection scan • All devices shall be capable of performing passive and orphan scans across a specified list of channels. • An FFD shall be able to perform energy detection and active scans. CGU NDSL LR-WPAN - 88 Energy detection channel scan • FFD obtain the peak energy in each requested channel. • A PAN coordinator select a channel for a new PAN. • During an energy detection scan, the MAC sublayer shall discard all frames received over the PHY layer data service. CGU NDSL LR-WPAN - 89 Active channel scan • An active scan allows an FFD to locate any existing coordinator transmitting beacon frames within its POS • This is used by PAN coordinator to select a PAN identifier prior to starting a new PAN, or it could be used by a device prior to association. CGU NDSL LR-WPAN - 90 Passive channel scan • A passive scan, like an active scan, allows a device to locate any coordinator transmitting beacon frames within its POS. • The beacon request command, however, is not transmitted. This type of scan could be used by a device prior to association. CGU NDSL LR-WPAN - 91 Orphan channel scan • Allows a device to attempt to relocate its coordinator following a loss of synchronization. • If a coordinator receives the orphan notification command – it searches its device list for the device sending the command. – If found, it sends a coordinator realignment command to the orphaned device. – The coordinator realignment command contains » » » » its current PAN identifier macPANId its current logical channel the short address of the orphaned device • The coordinator realignment command shall occur within aResponseWaitTime symbols. • The orphan scan shall terminate when – receives a coordinator realignment command – the specified set of logical channels has been scanned. CGU NDSL LR-WPAN - 92 MAC Command Frame Formats goto MAC command frame format CGU NDSL LR-WPAN - 93 Orphaned device realignment • If the next higher layer receives repeated communications failures following its requests to transmit data, it concludes that it has been orphaned. • If the orphan scan is successful, the device updates its MAC PIB (PAN Information Base) with the PAN information contained in the coordinator realignment command. • If the orphan scan was unsuccessful, the next higher layer shall decide what further action need be taken, e.g. to retry the orphan scan or attempt to re-associate. CGU NDSL LR-WPAN - 94 PAN identifier conflict resolution • When two PANs exist in the same POS with the same PAN identifier. – The coordinator and its devices performs PAN identifier conflict resolution procedure. • PAN coordinator detects conflict : – Beacon frame is received by the PAN coordinator with the PAN coordinator subfield set to 1 and the PAN identifier equal to macPANId. – A PAN ID conflict notification command is received by the PAN coordinator from a device on its PAN. • Device detects conflict : – Beacon frame is received by the device with the PAN coordinator subfield set to 1, the PAN identifier equal to macPANId and an address which is not equal to both macCoordShortAddress and macCoordExtendedAddress. CGU NDSL LR-WPAN - 95 PAN identifier conflict resolution • PAN coordinator detects conflict: – Action » first perform an active scan » using the information from the scan, select a new PAN identifier » broadcast the coordinator realignment command containing the new PAN identifier with the source PAN identifier field equal to the value in macPANId • Device detects conflict : – Action » it generates the PAN ID conflict notification command and send it to the PAN coordinator. » If the PAN coordinator receives it correctly, it sends an acknowledgment frame to confirm receipt. » The PAN coordinator then resolve the conflict as described above. CGU NDSL LR-WPAN - 96 Starting a PAN • A PAN is started by – an FFD – after an active channel scan – a suitable PAN identifier is selected • The algorithm for selecting a suitable PAN identifier from the list of PAN descriptors returned from the active channel scan procedure is out of the scope of this standard. • The FFD sets macShortAddress to a value less than 0xffff. CGU NDSL LR-WPAN - 97 Beacon generation • A device transmits beacon frames only if macShortAddress 0xffff. • The FFD may either begin beacon transmission as the PAN coordinator of a new PAN or as a device on a previously established PAN. • The address used in the source address field of the beacon frame shall contain – aExtendedAddress when macShortAddress = 0xfffe – macShortAddress otherwise. • All beacon frames shall be transmitted at the beginning of each superframe at an interval equal to aBaseSuperframeDuration * 2n symbols, where n is the value of macBeaconOrder. CGU NDSL LR-WPAN - 98 Device discovery • An FFD may indicate its presence on a PAN to other devices by transmitting beacon frames. This allows the other devices to perform device discovery. CGU NDSL LR-WPAN - 99 Association • A device first performs active or passive channel scan • Then choose a suitable PAN • Sent an associate request command frame to the PAN coordinator and waits the returned acknowledgement frame – The ack frame does not mean that the device has associated – The coordinator decides within aResponseWaitTime symbols • Receive an association response command frame with status code from coordinator – Success : contains a short address to the device – Failure : sufficient resources are not available • Following the selection of a PAN, it sets – phyCurrentChannel – macPANId – macCoordExtendedAddress or macCoordShortAddress, associate request command frame CGU NDSL LR-WPAN - 100 Association Request Command Format FFD/RFD CGU NDSL LR-WPAN - 101 Association • If the association is successful, the device shall store the addresses of the coordinator with which it has associated. – the short address of the coordinator (contained in the beacon) is stored in macCoordShortAddress – the extended address of the coordinator (contained in the MAC header of the association response command frame) is stored in macCoordExtendedAddress. CGU NDSL LR-WPAN - 102 Association • The device also stores the assigned short address into macShortAddress • Three types of macShortAddress – 0x0000-0xfffd : for data communications – 0xfffe : still uses 64-bit extended address even associated – 0xffff : not associated yet CGU NDSL LR-WPAN - 103 Disassociation • When a coordinator wants one of its associated devices to leave the PAN, it shall send the disassociation notification command frame to the device using indirect transmission. disassociation notification command frame CGU NDSL LR-WPAN - 104 Frame Transmission • If the source address (SA) field is not present, the originator of the frame shall be assumed to be the PAN coordinator. • If the destination address (DA) field is not present, the recipient of the frame shall be assumed to be the PAN coordinator. • If both SA and DA addresses are present, the MAC shall compare the destination and source PAN identifiers – If the PAN identifiers are identical, the intra PAN subfield of the frame control field shall be set to 1 and the source PAN identifier shall be omitted from the transmitted frame. » Save bandwidth, only carry the destination PAN identifier – If the PAN identifiers are different, the intra PAN subfield of the frame control field shall be set to 0 and both destination and source PAN identifier fields shall be included in the transmitted frame. CGU NDSL LR-WPAN - 105 Frame reception and rejection 1. The frame type subfield shall not contain an illegal frame type. 2. If the frame type indicates that the frame is a beacon frame, the source PAN identifier shall match macPANId unless macPANId is equal to 0xffff, in which case the beacon frame shall be accepted regardless of the source PAN identifier. 3. If a destination PAN identifier is included in the frame, it shall match macPANId or shall be the broadcast PAN identifier (0xffff). 4. If a short DA is included in the frame, it shall match either macShortAddress or the broadcast address (0xffff). Otherwise, it shall match aExtendedAddress. 5. If only SA fields are included in a data or MAC command frame, the frame shall only be accepted if the device is a PAN coordinator and the source PAN identifier matches macPANId. CGU NDSL LR-WPAN - 106 Acknowledgment Request Mechanism • Acknowledgement request (AR) subfield set to 0 – Beacon frame – Acknowledgment frame – Any broadcast frame • The transmission of an acknowledgement frame in the CAP shall commence at a backoff slot boundary. CGU NDSL LR-WPAN - 107 Retransmissions • If direct transmission fails, the device retransmits the frame and waiting for the ACK, up to a maximum of aMaxFrameRetries times. success fail after retry success after retry CGU NDSL LR-WPAN - 108 GTS allocation and management • Guaranteed time slot (GTS) allows a device to operate on the channel without interferences. • A GTS only be allocated by the PAN coordinator and is used for communications between PAN coordinator and device. • A data frame transmitted in an allocated GTS shall use only short address • The PAN coordinator shall send all frames within a receive GTS with AR=1 • The PAN coordinator may allocate up to seven GTSs at the same time, provided there is sufficient capacity in the superframe. CGU NDSL LR-WPAN - 109 GTS allocation and management • A single GTS occupies one or more superframe slots • GTSs are allocated on a first-come-first-served basis and all GTSs shall be placed contiguously at the end of the superframe and after the CAP • For each GTS, the PAN coordinator records – – – – starting slot length (in superframe slots) direction associated device address • For each allocated GTS, the device records – starting slot – length – direction CGU NDSL LR-WPAN - 110 GTS Allocation initiated by a device Inform the GTS CGU NDSL LR-WPAN - 111 GTS request command frame GTS request command frame 0: receive 0: GTS allocation 1: transmit 1: GTS deallocation (device’s view) CGU NDSL LR-WPAN - 112 GTS Deallocation initiated by a device initiated by coordinator CGU NDSL LR-WPAN - 113 GTS reallocation deallocated compact CGU NDSL LR-WPAN - 114 GTS expiration • The PAN coordinator attempts to detect when a device has stopped using a GTS using the following rules: – For a transmit GTS (uplink), the PAN coordinator does not receive data frames from the device at least every 2*n superframes – For receive GTSs (downlink), the PAN coordinator does not receive ACK frames from the device at least every 2*n superframes • The value of n is defined as follows: – n = 2(8-macBeaconOrder) –n=1 0 ≤ macBeaconOrder ≤ 8 9 ≤ macBeaconOrder ≤ 14 CGU NDSL LR-WPAN - 115 General MAC frame format frame control field CGU NDSL LR-WPAN - 116 Frame control field • Frame type – – – – Beacon (000) Data (001) Acknowledgment (010) MAC command (011) • Security enabled subfield (like WEP bit in 802.11) – Encrypted (1) – No Encryption (0) • Frame pending subfield (like More bit in 802.11) – Device sending the frame has additional data to send (1) – No more data (0) – Used in CAP only • Acknowledgment request subfield – Need ACK (1) – Bypass ACK(0) CGU NDSL LR-WPAN - 117 Frame control field • Intra PAN subfield – both DA and SA are present and the frame should not contain the source PAN identifier field (1) – both DA and SA are present and the frame shall contain both destination and source PAN identifier fields (0) • Destination addressing mode subfield • Source addressing mode subfield CGU NDSL LR-WPAN - 118 Sequence number field • The sequence number field is 8-bits in length • In the case of a beacon frame, the sequence number field shall specify a beacon sequence number (BSN). – Each coordinator shall store its current BSN value in the MAC PIB attribute macBSN and initialize it to a random value. • In the case of a data, acknowledgment or MAC command frame, the sequence number field shall specify a data sequence number (DSN) that is used to match an acknowledgment frame to the data or MAC command frame. CGU NDSL LR-WPAN - 119 PAN identifier field • 16-bits in length • Destination PAN ID – A value of 0xffff in this field shall represent the broadcast PAN identifier which shall be accepted as a valid PAN identifier by all devices currently listening to the channel. • Source PAN ID – Appear in the MAC frame only if » source addressing mode = 1 » intra PAN subfields = 0 CGU NDSL LR-WPAN - 120 Address fields • Either 16- or 64-bits in length, according to the value specified in the source/destination addressing mode subfield of the frame control field. CGU NDSL LR-WPAN - 121 CRC-16 CGU NDSL LR-WPAN - 122 Format of individual frame types • There are four defined frame types: – – – – Beacon Data Acknowledgment MAC command. CGU NDSL LR-WPAN - 123 Beacon frame format Beacon frame BO SO specifies the final superframe slot in CAP CGU NDSL LR-WPAN - 124 Superframe specification field • The battery life extension subfield indicates frames transmitted to the beaconing device during the CAP are required to start in or before the sixth full backoff period following the beacon’s IFS period. Otherwise, the battery life extension subfield shall be set to 0. CGU NDSL LR-WPAN - 125 Beacon frame format =0 >0 always appear the direction of data frame transmission by the device GTS descriptor CGU NDSL LR-WPAN - 126 Pending address information fields Beacon frame 3-bit 3-bit CGU NDSL LR-WPAN - 127 Address list field • The size of the address list field is determined by the values specified in the pending address specification field of the beacon frame. • The address list shall not contain the broadcast short address 0xffff. • The maximum number of addresses pending shall be limited to seven and may be comprised of both short and extended addresses. • All pending short addresses appear first in the list followed by any extended addresses CGU NDSL LR-WPAN - 128 Data frame format • The address length is depending on following parameters defined in frame control field – Destination addressing mode subfield – Source addressing mode subfield • The sequence number is the data sequence number (DSN) variable (DSN) CGU NDSL LR-WPAN - 129 Acknowledgment frame format • The frame pending subfield in frame control field shall be set according to whether the device sending the ACK frame has more data pending for the recipient. CGU NDSL LR-WPAN - 130 MAC command frame format variable CGU NDSL LR-WPAN - 131 Association request command • The source addressing mode subfield of the frame control field shall be set to 3 (64-bit extended addressing). • The destination addressing mode subfield shall be set to the same mode as indicated in the beacon frame. • The destination address field shall contain the coordinator’s address from the beacon frame. • The source PAN identifier field shall contain the broadcast PAN identifier (0xffff). The source address field shall contain the value of aExtendedAddress. CGU NDSL LR-WPAN - 132 Association request command 3+14 or 3+20 CGU NDSL LR-WPAN - 133 Capability information field • Alternate PAN coordinator subfield – the device can act as a PAN coordinator (1) – Otherwise (0) • Device type subfield – the device is an FFD (1) – the device is a RFD (0) • power source subfield – the device is receiving power from the alternating current mains (1) – Otherwise (0) • receiver on when idle subfield – device does not disable its receiver to conserve power during idle periods (1) – Otherwise (0) CGU NDSL LR-WPAN - 134 Capability information field • Security capability subfield – the device is capable of sending and receiving MAC frames secured using the security suite (1) – Otherwise (0) • Allocate Address subfield – the device request a short address (1) – Otherwise; the special short address of 0xfffe shall be allocated to the device and returned through the association response command (0) CGU NDSL LR-WPAN - 135 Association response command 3+20 • Short address filed – 0xffff : the coordinator was not able to associate this device to its PAN (the association status field contains the reason for the failure) – 0xfffe : the device has been successfully associated with a PAN but has not been allocated a short address – 0x0000-0xfffd : the device has been successfully associated with a PAN and has been allocated a short address. CGU NDSL LR-WPAN - 136 Association status field CGU NDSL LR-WPAN - 137 Disassociation notification command 3+14 • Either the coordinator or an associated device may send the disassociate notification command. • DA = aExtendedAddress (Coordevice) or DA = macCoordExtendedAddress (deviceCoor) • SA = aExtendedAddress. CGU NDSL LR-WPAN - 138 Disassociation reason field CGU NDSL LR-WPAN - 139 Data request command • All devices shall be capable of transmitting this command, although an RFD is not required to be capable of receiving it. CGU NDSL LR-WPAN - 140 PAN ID conflict notification command • The PAN ID conflict notification command is sent by a device to the PAN coordinator when a PAN identifier conflict is detected. CGU NDSL LR-WPAN - 141 Orphan notification command • The orphan notification command is used by an associated device that has lost synchronization with its coordinator. CGU NDSL LR-WPAN - 142 Beacon request command • The beacon request command is used by a device to locate all coordinators within its POS during an active scan. • This command is optional for an RFD. CGU NDSL LR-WPAN - 143 Coordinator realignment command • The coordinator realignment command is sent by a coordinator : – following the reception of an orphan notification command from a device that is recognized to be on its PAN – when any of its PAN configuration attributes change. • If the coordinator realignment command is broadcast to the PAN, the short address field shall be set to 0xffff and ignored on reception. CGU NDSL LR-WPAN - 144 GTS allocation and deallocation GTS request command format 1 : allocation 0: deallocation • An associated device uses this command to request the allocation of a new GTS or the deallocation of an existing GTS. CGU NDSL LR-WPAN - 145 MAC Constants (1/2) CGU NDSL LR-WPAN - 146 MAC Constants (2/2) CGU NDSL LR-WPAN - 147 MAC PIB Attributes CGU NDSL LR-WPAN - 148 MAC PIB Attributes (1/3) CGU NDSL LR-WPAN - 149 MAC PIB Attributes (2/3) CGU NDSL LR-WPAN - 150 MAC PIB Attributes (3/3) CGU NDSL LR-WPAN - 151 MAC PIB security attributes CGU NDSL LR-WPAN - 152 Elements of ACL entry descriptor CGU NDSL LR-WPAN - 153 PAN start message sequence chart - PAN coordinator CGU NDSL LR-WPAN - 154 Energy detection scan CGU NDSL LR-WPAN - 155 Association message sequence chart device CGU NDSL LR-WPAN - 156 Passive scan message sequence chart CGU NDSL LR-WPAN - 157 Data transmission message sequence chart originator CGU NDSL LR-WPAN - 158 Data transmission message sequence chart recipient CGU NDSL LR-WPAN - 159 More Information www.IEEE802.org – http://www.ieee802.org/15/pub/TG4.html Thank You. Questions ? CGU NDSL LR-WPAN - 160 CGU NDSL LR-WPAN - 161