lab 4 additional notes · the 802.15.4 standard defines that there are two types of devices that...

27
Lab 4 Additional Notes Excerpt from a thesis by Mathew Brian Cover The University of Iowa Department of Electrical and Computer Engineering Copyright 2007

Upload: others

Post on 29-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

Lab 4 Additional Notes

Excerpt from a thesis by

Mathew Brian Cover

The University of Iowa Department of Electrical and Computer Engineering

Copyright 2007

Page 2: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

4

CHAPTER 2

IEEE 802.15.4 STANDARD

IEEE 802.15.4 Overview

The IEEE 802.15.4-2003 standard was approved on May 12th

, 2003 in an attempt

to define a standard that would:

“provide a standard for ultra-low complexity, ultra-low cost, ultra-low power consumption, and low data rate wireless connectivity among inexpensive devices.” [1]

The IEEE 802.15.4-2006 standard was approved on June 8th

, 2006 and published

in September 2006 in an attempt to extend and make the standard easier to use [11]. The

IEEE 802.15.4-2006 revision is backward-compatible with the 2003 revision. The

802.15.4 standard primarily defines the physical layer (PHY) and medium access control

(MAC) sublayer for low-rate wireless personal area networks (LR-WPAN). However, it

offers much in terms of guidelines for network layers and possible software architectures.

The 802.15.4 standard defines that there are two types of devices that can

participate in a network: full-function devices (FFDs) and reduced-function devices

(RFDs). Only a FFD can serve as a personal area network (PAN) coordinator [1]. FFDs

can serve as a PAN coordinator, a coordinator, or a device. A FFD generally has more

memory, computing power, and a longer duration power supply when compared to a

RFD. A RFD is a device with a minimal implementation of the IEEE 802.15.4 protocol

and can only assume the role of a device. The standard allows a RFD to only associate

with a single FFD at any one time. Should a RFD need to communicate to another RFD,

it needs to do so through at least one FFD to relay the message.

Topologies

The 802.15.4 specification defines two types of topologies of networks that can be

formed using the standard: star and peer-to-peer. Both types require at least one FFD to

serve as the PAN coordinator. Every node in either network topology also will have a

Page 3: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

5

unique 64-bit address to identify itself. However, the PAN coordinator will assign every

node a 16-bit short address when it associates with the network that can be used in place

of the 64-bit address.

Star Network

In a star network, a single FFD controller operates as the PAN coordinator and

talks with all devices of the network directly. It is responsible for establishing and

maintaining the network. All of the other devices can be either FFD or RFD but are only

allowed to communicate with other nodes via the PAN coordinator [1]. In other words,

all messages passed in the star network are required to go through, originate, or end at the

PAN coordinator.

Figure 2: Star topology

When a PAN coordinator starts a network, it chooses a unique PAN identifier for

other nodes that want to join to identify it by and distinguish it from other networks that

may be in the area. This type of network works best when all the devices participating are

Page 4: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

6

within a relatively small area so that every node falls within the radio sphere of the

coordinator.

Peer to Peer Network

A peer to peer network also has a single PAN coordinator; however, FFDs are

allowed to communicate amongst themselves without routing messages through the PAN

coordinator [1]. This allows for more complex network setups where multiple hops can

be used to deliver messages among nodes, more efficiently. This also permits the

physical area of the network to extend beyond what a star topology would allow. Peer-

to-Peer topologies provide the groundwork for more complex network setups such as

mesh/cluster-tree topologies.

Figure 3: Peer to peer topology

Page 5: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

7

Cluster-Tree

A cluster-tree is an example of how the peer-to-peer topology may be

implemented. Most devices that participate in a cluster-tree are FFDs but RFDs are

allowed to connect to the network as a leaf node at the end of a branch of FFDs since

RFDs are only allowed to associate with one FFD at a time. Multiple FFDs can serve as a

coordinator, but only one is allowed to be the PAN coordinator for the entire network.

The PAN coordinator establishes itself as the cluster head (CLH) with a cluster identifier

(CID) of zero. Larger networks are possible by forming a mesh of multiple neighboring

clusters or a tree of clusters, hence the term cluster-tree. The lines seen in Figure 4

represent parent-child relationships and not necessarily communication flow. The

advantage of a cluster-tree structure is increased coverage area, while the disadvantage is

an increase in message latency.

Figure 4: Cluster-Tree Topology

Page 6: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

8

Physical Layer

The physical layer (PHY) of 802.15.4 is the interface between the radio channel

of transmission and the medium access control (MAC) sublayer. The PHY is responsible

for the following tasks:

• Activation and deactivation of the radio transceiver

• Energy detection (ED) within the current channel

• Link quality indication (LQI) for received packets

• Clear channel assessment (CCA) for carrier sense multiple access with collision

avoidance (CSMA-CA)

• Channel frequency selection

• Data transmission and reception

Figure 5: 2450 MHz PHY modulation and spreading functions

A direct sequence spread spectrum (DSSS) radio uses a scheme in which groups

of bits are represented by a symbol. The 2450 MHz PHY employs a 16-ary quasi-

orthogonal modulation technique where each data symbol period, four information bits

are used to select a value which consists of 32 bits in a pseudo-random noise (PN)

sequence to be transmitted called a ‘chip’ (Table 1). The aggregate chip sequence is

modulated onto the carrier using offset quadrature phase-shift keying (O-QPSK) (see

Figure 5). Within each byte/octet, the least significant symbol (b0, b1, b2, b3) is processed

first and the most significant symbol (b4, b5, b6, b7) is processed second.

Page 7: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

9

Table 1: Symbol-to-chip mapping

Data Symbol (decimal) Data Symbol (binary)

(b0, b1, b2, b3)

Chip values (c0, c1, … c30, c31)

0 0000 11011001110000110101001000101110

1 1000 11101101100111000011010100100010

2 0100 00101110110110011100001101010010

3 1100 00100010111011011001110000110101

4 0010 01010010001011101101100111000011

5 1010 00110101001000101110110110011100

6 0110 11000011010100100010111011011001

7 1110 10011100001101010010001011101101

8 0001 10001100100101100000011101111011

9 1001 10111000110010010110000001110111

10 0101 01111011100011001001011000000111

11 1101 01110111101110001100100101100000

12 0011 00000111011110111000110010010110

13 1011 01100000011101111011100011001001

14 0111 10010110000001110111101110001100

15 1111 11001001011000000111011110111000

Because the number of data bits is being represented by a greater number of

pseudo-random bits in a chip, the data rate for the chips must be greater than what it

would be for the raw data (Table 1). The chip rate is 32 times the symbol rate and 8 times

the raw data rate. The increase in the data rate spreads the signal over a wider bandwidth.

This spread spectrum characteristic makes IEEE 802.15.4 resistant to narrow-band noise.

The data rate for 802.15.4 depends on what range of frequencies a device is

operating on. For the 2.4GHz band, the raw data rate is 250kb/s, 915MHz data rate is

40kb/s, and 868MHz is 20kb/s. The 868/915 MHz band has a similar modulation scheme,

but will not be discussed further in this document since these bands are not used for the

Page 8: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

10

research application detailed in this thesis. Key metrics for IEEE 802.15.4 can be found

in Table 2.

There are a total of 27 channels combined over the three frequency ranges

numbered from 0 to 26. Channel 0 is for 868MHz band. Channels 1 through 10 belong to

the 915 MHz band and channels 11 through 26 to the 2450 MHz band. The center

frequency for each channel is determined according to [1] as follows:

Fc = 868.3 in megahertz, for k = 0

Fc = 906 + 2(k-1) in megahertz, for k = 1, 2, …, 10

Fc = 2405 + 5(k-11) in megahertz, for k =11, 12, …, 26

where k is the channel number.

Table 2: PHY characteristics for IEEE 802.15.4-2003 [1]

Spreading parameters Data Parameters PHY (MHz)

Frequency Band (MHz)

Chip rate (kchips/s)

Modulation Bit rate (kb/s)

Symbol rate (ksymbol/s)

Symbols

868-868.6 300 BPSK 20 20 Binary 868/915

902-928 600 BPSK 40 40 Binary

2450 2400-2483.5

2000 O-QPSK 250 62.5 16-ary Orthogonal

[1] states that RF power measurement shall be made at the transceiver to antenna

connector. For devices without an antenna connector, the measurements will be

interpreted as effective isotropic radiated power (EIRP, i.e. a 0dBi gain antenna). This is

where the received signal strength indicator (RSSI) is determined.

Page 9: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

11

PHY Frame Format

The PHY protocol data unit (PPDU) has the format as depicted in Figure 6 where

the leftmost field is transmitted/received first. Each PPDU packet consists of the three

components:

• A synchronization header (SHR), which allows a receiving device to synchronize

and lock onto the bit stream. This consists of four bytes of zeros and 1 byte of a

pre-defined start-of-frame delimiter (SFD).

• The PHY header (PHR), which contains frame length information (from 0 to 127,

inclusive).

• The PHY service data unit (PSDU) which carries the MAC sublayer frame of

variable length.

Figure 6: PHY Frame Format or PPDU

The link quality indication (LQI) measurement is a way for a receiver to

characterize the quality and/or signal strength of a received packet. It can be implemented

using the receiver energy detection (ED), a signal-to-noise ratio estimation, or a

combination of these factors. The LQI is reported for every packet received to the MAC

sublayer as an integer ranging from 0x00 to 0xFF. However, the use of the LQI in the

network and application layers is not required by the IEEE 802.15.4 specification [11].

The 802.15.4 PHY also provides the capability to perform clear channel

assessment (CCA) according to at least one of three modes:

Page 10: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

12

• Mode 1: Energy above the threshold. CCA will report a busy channel if it detects

energy above the energy detection (ED) threshold.

• Mode 2: Carrier sense only. CCA will report a busy channel if it detects signals

comparable to the modulation and spreading characteristics of 802.15.4

transmissions regardless if the energy is above or below the ED threshold.

• Mode 3: Carrier sense with energy above the threshold. CCA will report busy

only if it detects signals that are demonstrating characteristics of 802.15.4

transmissions with energy above the ED threshold.

For any of the CCA modes, PPDU reception is considered to be in progress

following the detection of the SFD, and it remains in progress until the number of octets

specified by the decoded PHR has been received.

MAC Sublayer

The MAC sublayer coordinates all access to the physical radio channel and is

responsible for the following tasks:

• Generating network beacons if the device is a coordinator

• Synchronizing to the beacons

• Supporting PAN association and disassociation

• Supporting device security

• Employing the CSMA-CA mechanism for channel access

• Handling and maintaining the guaranteed time slot (GTS) mechanism

• Providing a reliable link between two peer MAC entities

MAC Frame Format

Each MAC protocol data unit (MPDU) can be visualized as shown in Figure 7

where each field is transmitted/received as seen from the leftmost field to the rightmost

field. The MPDU can be broken down into three components:

Page 11: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

13

• A MAC Header (MHR) which comprises frame control, sequence number, and

address information.

• A MAC Payload, which contains information specific to the frame type.

• A MAC Footer (MFR), which contains a two byte frame check sequence (FCS).

There are four frame types that are defined in [1]: beacon, data, acknowledgment

(ACK), and MAC command types.

An acknowledgement frame is different from data frames in that it has no

payload. Also the addressing fields may not be included in all frames. For example, the

beacon frames only include the source address frames.

Figure 7: General MAC Frame Format

The 16-bit FCS of the MPDU is calculated over the MHR and MAC payload parts

of the frame using the standard generator polynomial of degree 16:

x16

+ x12

+ x5 + 1

A FFD need to be capable of transmitting and receiving all command frame types,

while RFDs only need to be able to transmit and receive some of them. For example, an

RFD does not need to be able to receive association requests since RFDs can only serve

as child nodes and not as a parent to any other node.

Page 12: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

14

There are two different types of communication access schemes defined at the

MAC sublayer: beacon and beacon-less networks also known as contention free and

contention networks, respectively. Beacon-less networks allows devices to access the

channel in a distributed fashion using a CSMA-CA back-off algorithm. Every device

listens before transmitting to ensure the channel is free so as to reduce the likelihood of

two devices transmitting at the same time (collision avoidance). If a device suspects that

it transmitted at the same time that another device was transmitting, it will attempt to re-

transmit the packet at a later time. The other device will probably do the same, but will

most likely reschedule it’s transmission at a different time because the delay is based on a

random number generator. In a busy network this could mean many devices are not able

to transmit their messages and the packets could become classified as “old” before they

are successful in being transmitted. This also means that in beacon-less networks, the

exact time delivery of data cannot be guaranteed.

In this scheme, devices only use power to transmit when they have something to

say and the channel is suspected to be clear. This allows the nodes to conserve much of

their power and holds a huge advantage over time-synchronized-only devices such as

Bluetooth (IEEE 802.15.1). In Bluetooth, devices have to continually transmit packets

even when they don’t have anything to say in order to stay synchronized with the

network which expends a lot of power [13].

In 802.15.4 beacon networks, there is a frame format which is called a superframe

that is defined by the period of time between periodic beacons broadcasted by the

coordinator device in a network. Each beacon has information coded into the frame

indicating the structure of the superframe. A superframe is divided into two parts, an

active and inactive part. The active part is divided into 16 equal-width time slots that are

individually designated as contention access period (CAP) or contention free period

(CFP) time slots. They are assigned according to the information in the preceding beacon.

Every node in the network should be powered up and listening prior to a beacon

Page 13: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

15

transmission in order to receive the structure of the next superframe. During the inactive

portion of the superframe, nodes can power down in order to save power as long as they

are back up and listening at the next beacon.

Figure 8: Superframe Format

The CFP slots are optional, but only up to seven of them can be designated as

such while the rest are required to be part of the CAP. CFP slots are also required to

come at the end of the active period. A guaranteed time slot (GTS) allows a single device

to have a reserved time slot to communicate over the network without any competition

for any other device. A GTS can be made of a single or multiple CFP slots grouped

together. The assignment of a GTS to a device is coded in the beacon for the superframe.

The time between two beacons is called the beacon interval (BI) and is calculated

with a parameter called the beacon order (BO). The BI is figured with the equation

BI = aBaseSuperFrameDuration*2BO

where 0 ≤ BO ≤ 14. When BO = 15, this signifies communications will be conducted in

beacon-less mode.

Page 14: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

16

Transfer Methods

There are three scenarios for both beacon mode and beacon-less mode in which

packet transmission could happen: from the coordinator to device, the device to a

coordinator, and device to device (peer-to-peer).

Coordinator to Device

In a beacon-enabled network, if a coordinator wants to send information to a

device, it will be indicated in a beacon so that the device listening to the beacon readies

itself for reception of data. If a device wants to request data from a coordinator, it will

send a data request frame to the coordinator after the beacon is broadcasted by the

coordinator. The coordinator responds to the data request with an ACK frame and then

the data. The end device responds to the successful reception of the data with an ACK of

its own to the coordinator (Figure 9a).

Figure 9: Coordinator to Device Communication

In a beacon-less network, there is no way for the coordinator to tell the device that

it has a message for it, since in most cases the device will be asleep and will not be

Page 15: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

17

listening for messages. The coordinator needs to store the data in memory until a device

requests if it has any messages. Once a coordinator receives a data request from a device,

it checks to see if there are any messages for the requesting device. If so, it will send an

ACK frame followed by the data (if any, otherwise the data length will be zero). The

requesting device will then send an ACK frame to acknowledge the successful reception

of data from the coordinator (Figure 9b).

Device to Coordinator

In a beacon-enabled network a device may want to send data to the coordinator. If

this is the case, the device will listen for the beacon frame from the coordinator. The

device will then send it’s data using slotted CSMA-CA during the CAP where after the

coordinator will respond with an ACK frame once it is successful in it’s transmission

(Figure 10a). In a non-beacon enabled network, the device will transmit whenever it is

ready by using CSMA-CA to reduce packet collision. The coordinator can send an ACK

frame in response once the transmission is successful (Figure 10b).

Figure 10: Device to Coordinator communication

Page 16: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

18

Peer-to-Peer

Peer-to-peer communication is fairly straight forward for beacon-less enabled

networks. Every node needs to be constantly powered on and any transmission among

nodes will be conducted with CSMA-CA. Beacon-enabled networks poses more of a

problem as IEEE 802.15.4 leaves some complications unanswered. For a network with

multiple FFDs, there could be beacons from different sources which causes

synchronization issues so that the nodes can fall asleep without loss of data. This

synchronization is not defined anywhere for the MAC and is left for the higher layers

(network, application) to resolve. This leaves beacon-enabled communication between

two devices only possible with star topographies (one coordinator) which are really the

device to coordinator and coordinator to device communication schemes for beacon-

enabled networks.

Page 17: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

19

CHAPTER 3

ZIGBEE PROTOCOL STANDARD

ZigBee Concept

A group of companies comprise an association known as the ZigBee Alliance

who have worked together to devise a wireless standard that is called ZigBee. The idea is

that products such as consumer electronics, home and building automation, industrial

controls and monitors, medical applications, computer peripherals, toys and games

should be able to adopt the standard [4]. ZigBee also promotes ad hoc wireless sensor

networks in the sense that one can program each node with the same code with the only

difference among nodes being that each one has a unique 64-bit address. The network can

setup and organize itself without any intervention once each node is powered. The mesh

networking capability makes up for the limited power of each node in a ZigBee network

through efficiency in relaying data.

ZigBee Architecture

The ZigBee architecture is a stack architecture based on the Open Systems

Interconnection (OSI) seven-layer model architecture, but defines only layers that are

necessary to complete the intended function [4]. It capitalizes on the IEEE 802.15.4 lower

levels (PHY and MAC sublayer) that have been defined in [1] already and summarized in

Chapter 2. ZigBee builds on this with a network layer (NWK) implementation and

application layer. The application layer is comprised of the application support sub-layer

(APS), the ZigBee device object (ZDO) and manufacturer defined application objects.

Each layer of the overall stack has service access points (SAP) which supports the

communication between layers of the ZigBee stack. These SAPs can be found in Figure

11 connecting the each layer of the stack to the layer immediately next to it.

Page 18: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

20

Figure 11: ZigBee Stack Architecture

ZigBee Components

The ZigBee protocol defines three different types of devices that can participate in

a ZigBee network. The first type of node is the ZigBee coordinator node which is

required to be a FFD. Only one ZigBee coordinator is allowed per network. The second

type of node is a ZigBee router node and also is a FFD, but is considered an optional

component of a ZigBee network. A router’s primary function is to extend the range of the

network by forwarding packets from one node to another through the network. It can also

be capable of performing duties as an end device by taking on monitoring duties and/or

Page 19: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

21

control functions. The third and last type of device is the ZigBee end device which is

typically hosted on an RFD, but could also be on a FFD. These are limited in their

abilities and generally reserved for monitoring and/or control functions.

Network Layer

The primary responsibilities of the ZigBee network layer (NWK) is to provide

mechanisms for the following capabilities:

• Joining and leaving a network

• Applying security to the frames

• Route frames to their intended destinations

• Discover and maintain routes between devices

• Discover one-hop neighbors

The ZigBee NWK supports star, tree, and mesh topologies. The star network is

controlled by a single ZigBee coordinator. The ZigBee coordinator is responsible for

initializing the network, allowing end devices to join the network, and maintaining the

network. The end devices are allowed to directly communicate with the ZigBee

coordinator and indirectly to other end devices in a star network (Figure 12).

In mesh and tree topologies, the ZigBee coordinator is again responsible for

starting and maintaining the network, but this time the network can be extended with

ZigBee routers. In tree topologies, messages can be moved through the network in a

hierarchical fashion via the routers that act as the backbone of the network (Figure 12).

Tree topologies may employ beacon-enabled communication. Mesh networks allow for

full peer-to-peer operation as explained in IEEE 802.15.4. However, ZigBee mesh

networks are not permitted the use of beacons. End devices are allowed to connect to

either mesh or tree topologies, but are still limited to connecting to only one FFD device

whether that be a ZigBee coordinator or router.

Page 20: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

22

Figure 12: ZigBee Network Topologies

Application Layer

The application layer consists of the Application Framework, ZigBee Device

Object (ZDO), the Application Support Sublayer (APS), and any application objects

defined by the developer/manufacturer. The primary responsibilities of the APS are

maintaining tables for binding and forwarding messages between bound devices. The

APS also keeps track of the address mapping from 64 bit IEEE addresses to and from 16

bit NWK addresses.

ZigBee Device Object

The primary responsibilities of the ZDO include defining the role of the device

within the network (e.g. ZigBee coordinator, router, or end device), initiating and/or

Page 21: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

23

responding to binding and discovery requests, and establishing a secure relationship

between network devices. The ZDO is also responsible for discovering devices on the

network and determining which application services they provide. It is like a special

application object that is resident on every ZigBee node and always has endpoint 0 as it’s

designation.

Addressing

Every node that participates in a ZigBee network is required to have a globally

unique IEEE 802.15.4 64-bit MAC address regardless of what role it plays in the

network. The 64-bit address is made up of a 24-bit Organizationally Unique Identifier

(OUI) plus 40 bits that are assigned by the manufacturer/developer. After a coordinator

sets up a network, it assigns network addresses to new devices when they join the

network for the first time. The coordinator assigns itself a network address of 0x0000.

These network addresses are only assigned once so that if a device leaves the network or

becomes orphaned, it can later rejoin with the same network address without having to

worry about it’s network address being reassigned to another node. This also creates the

possibility of cloning a node with the exact same 64-bit IEEE address so it can be used to

replace a broken node in the network.

Packets can also be broadcasted to all 802.15.4 transceivers by using the MAC

layer destination address of 0xFFFF. This form of addressing is used primarily when

joining a network and when discovering routes in the network. Any node that is within

listening range of the broadcasting node will receive the message.

Endpoints

If there are several sensors and/or output mechanisms on one particular node,

ZigBee provides a sub-addressing scheme that can access each individual subunit on a

device which drives the concept of endpoints. There can be up to 240 user-defined

endpoints per node in the network. Endpoint 0 is reserved for the ZDO on every node.

Page 22: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

24

For example, if there are multiple switches on a particular node, each switch can be

assigned an endpoint so that the network will not only know which node that an event

(switch press) occurred on, but can know which switch on that node was activated. This

sub-addressing scheme allows manufactures to create their own devices that still conform

to a standard that everyone can follow and permits compatibility among ZigBee devices.

Profiles

ZigBee profiles are descriptions of how devices are organized and their interfaces

with other devices in the network. Profiles are just used to describe the communications

architecture, such as data or attributes that can be passed between nodes, and have no

code associated with them directly. Attributes passed in a network can be grouped into

what are called clusters. Interfaces are specified at the cluster level and endpoints can

support one or more clusters. The ZigBee Alliance is constantly defining “application

profiles” that will allow devices manufactured by different companies to talk to one

another. For example, the ZigBee Alliance has defined a “Home Control Lighting”

profile which defines the protocols so that a ZigBee light switch from company A will

work properly with ZigBee lights manufactured by company B.

Binding

Devices participating in a ZigBee network can communicate directly with each

other if they know the network address of the destination device. This method of sending

messages is called direct messaging. Due to the additional capabilities that are required of

a node in order to maintain these addresses, this is undesirable if the network is

considered to be large. ZigBee offers an alternative method of sending messages through

“binds” between devices. This method of sending messages is called indirect messaging.

The ZigBee coordinator is in charge of creating and maintaining a master table of

addresses for the network. It also has a table of matching services among nodes at the

cluster/endpoint level. Each of these pairs in the table is called a “binding.” Binding can

Page 23: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

25

be initiated by either the devices themselves or it can be created by the coordinator. Then

when a device wishes to send a message to one or more of destination devices that it is

bound to, it just has to send the message to the coordinator. The coordinator will take care

of relaying it to the appropriate destinations.

APS Frame Format

The APS frame (Application support sub-layer protocol data unit or APDU)

consists of the following basic components as seen in Figure 13:

• An APS header, which comprises frame control and addressing information.

• An APS payload, of variable length, which contains information specific to the

frame type.

The frame control field of the APDU contains information defining the frame

type, addressing fields and control flags regarding security and if an acknowledge frame

is requested upon receipt. The APS counter is a field 8 bits in length and this value is

incremented by one every time a new transmission is made. This is used to help prevent

the reception of duplicate frames.

Figure 13: General APS Frame Format

Page 24: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

26

Security

There are seven security levels that are defined in the ZigBee protocol

specification to protect the output packets. In addition to these seven levels, there is an

eighth mode, which specifies no security. The ZigBee coordinator configures the security

level that the entire network will operate on. These different modes provide different

types of security services which can be categorized into three groups: integrity checks,

encryption, and a combination of integrity and encryption. A summary of security levels

is provided in Table 3.

Message Integrity Code (MIC) Mode

The message integrity code (MIC) attached to the packet ensures that the packet,

including the header of the payload, has not been modified in anyway during

transmission. This is how ZigBee checks the integrity of packets sent in the network. The

bit-length of the MIC may take the values of 0, 32, 64, or 128 and determines the

probability that a random guess of the MIC would be correct. The packet payload is not

encrypted in this mode.

Encryption (ENC) Mode

This mode encrypts the payload of the packets sent in the network. The plaintext

content of the payload cannot be exposed without a valid security key. This mode alone

does not check the integrity of the frame or content of the header.

ENC-MIC Mode

This combines the two modes. In these modes, the payload is encrypted. In

addition to the encryption, the header and payload’s integrity are checked by the MIC

attached at the end of the packet.

Page 25: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

27

Table 3: Security levels available to the MAC, NWK, and APS layers [4]

Security Level Identifier

Security Level Sub-field

Security Attributes

Data Encryption Frame Integrity (length of MIC, in umber of bytes)

0x00 ‘000’ None OFF NO (M = 0)

0x01 ‘001’ MIC-32 OFF YES (M = 4)

0x02 ‘010’ MIC-64 OFF YES (M = 8)

0x03 ‘011’ MIC-128 OFF YES (M = 16)

0x04 ‘100’ ENC ON NO (M = 0)

0x05 ‘101’ ENC-MIC-32 ON YES (M = 4)

0x06 ‘110’ ENC-MIC-64 ON YES (M = 8)

0x07 ‘111’ ENC-MIC-128 ON YES (M = 16)

There are also two types of keys that can be found, network keys and link keys.

Network keys are known by all participating devices and are used to decrypt unicast

messages. Link keys are limited in the sense that only devices that need to know the key

are given the link key. This keeps nodes that have no business knowing the contents of

certain messages from accessing the payloads.

Technology Comparison

It is natural to compare what advantages and disadvantages ZigBee has when

compared to other wireless technologies. ZigBee has some similarities to Bluetooth

(IEEE 802.15.1) since they both attempt to create wireless personal area networks.

However, there are differences. ZigBee has a raw transfer rate of 250kbps while

Bluetooth’s raw transfer rate is 1 Mbps. ZigBee counters this slower data rate with a

larger range of operation, up to 100m between two nodes in some cases, while Bluetooth

rarely operates beyond 10m without a power amplifier.

Page 26: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

28

Table 4: Comparison of Wireless Technologies [12]

Wi-Fi Bluetooth ZigBee

Frequency Bands 2.4 GHz 2.4 GHz 2.4 GHz,

868 / 915 MHz

Stack Size ~1Mb ~1Mb ~20kb

Raw Data Rate 11 Mbps 1 Mbps 250kbps (2.4 GHz)

40kbps (915 MHz)

20kbps (868 MHz)

Number of Channels 11 - 14 79 16 (2.4 GHz)

10 (915 MHz)

1 (868 MHz)

Data Types Digital Digital,

Audio

Digital,

Key-Value Pairs

Inter-node Range 100m 10m – 100m 10m – 100m

Number of Devices 32 8 255 / 65535

Power Requirements Medium – hours on one battery

Medium – days on one battery

Very low – years on one battery

Architectures Star Star Star, Tree, Mesh

Best Applications Internet inside buildings

Computer and phone peripherals

Low-cost control and monitoring

ZigBee provides a means to complete simple tasks such as turning lights on and

off in a house at a much cheaper cost than a Bluetooth implementation. However, ZigBee

would not be ideally suited for any time-critical, high data rate applications such as audio

and video links. Point-to-point range is also limited with ZigBee nodes, but this is

compensated for with the cluster-tree topology in which networking provides a means to

send messages over far greater distances. ZigBee also allows a greater number of devices

to connect at anyone time than Bluetooth due to the flexibility in the addressing scheme

and MAC layer which gives the non-beacon networks such a great advantage.

IEEE 802.11x on the other hand is far faster than both ZigBee and Bluetooth in

data rate, but is terrible in portability and power consumption. It is not suitable for battery

Page 27: Lab 4 Additional Notes · The 802.15.4 standard defines that there are two types of devices that can participate in a network: full-function devices (FFDs) and reduced-function devices

29

operated applications in most situations. ZigBee also offers a less complex overhead so

that in software, code size is significantly reduced compared to Bluetooth and 802.11x.

ZigBee on the other hand is much more compatible with microcontroller devices and

low-power platforms. ZigBee also provides the most power efficiency of these wireless

technologies due to the fact it can put a number of network devices to sleep for extended

periods of time.