Wireless Control That Simply Works
Network Layer Overview
Ian Marsden, Integration Associates ZigBee NWG Chair
Embedded Systems Show, Birmingham, October 12th, 2006
Copyright 2006 ZigBee
TM
Alliance. All Rights Reserved.
ZigBee Stack
ZigBee is built upon the foundations provided by the IEEE 802.15.4 standard.
APSSE-SAP NLSE-SAP
Application Framework
ZPUI
Application Object 240
[On Endpoint 240] APSDE-SAP
Application Object 1
[On Endpoint 1] APSDE-SAP
ZigBee Device Object (ZDO)
[On Endpoint 0] APSDE-SAP
APSME-SAP
Security Service Provider
Application Support (APS) Layer
NLDE-SAP
NLME-SAP
Network (NWK) Layer
MCPS-SAP MLME-SAP
Medium Access Layer (MAC) Layer
PD-SAP PLME-SAP
Physical (PHY) Layer
ZigBee Stack
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
2
802.15.4 Architecture:
PHY Frequency Options Network Structure 802.15.4 Device Types Locating Networks Joining / Rejoining Networks Direct / Indirect Data Transmission
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
Architecture: 802.15.4 PHY Options
Freq Band 868 / 915 MHz 2.4 GHz
Bit Rate 20 / 40 kbps 250 kbps 1 / 10 16
Channels
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
Architecture: Network Structure in 802.15.4
802.15.4 FFD 802.15.4 RFD Network Association
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
Architecture: 802.15.4 Device Types
Full Function Device (FFD)
Capable of being the PAN Coordinator Implements processing of Association Request Implements processing of Orphan Notification Implements processing of Start Request Implements processing of Disassociation Notification
Reduced Function Device (RFD)
Can only associate and communicate with a FFD Reduced stack removes optional components
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
MLME_SCAN: Locating Networks
MAC / PHY
MLME_SCAN_request( ACTIVE ) CMD_BEACON_REQUEST
Channel n
BEACON BEACON
ScanDuration
CMD_BEACON_REQUEST
Channel n+1
BEACON
ScanDuration
BEACON
MLME_SCAN_confirm( Descriptors )
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
MLME_ASSOCIATE: Joining a Network
MAC / PHY
MLME_ASSOCIATE_request() CMD_ASSOCIATE_REQUEST
aResponseWaitTime
CMD_DATA_REQUEST CMD_ASSOCIATE_RESPONSE MLME_ASSOCIATE_confirm()
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
MLME_SCAN: Rejoining a Network
MAC / PHY
MLME_SCAN_request( ORPHAN ) CMD_ORPHAN_NOTIFICATION
Channel n
ScanDuration
CMD_ORPHAN_NOTIFICATION
Channel n+1
ScanDuration
CMD_COORD_REALIGNMENT
MLME_SCAN_confirm( Descriptors )
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
Data Transmission:
Direct (FFD
FFD, or RFD
FFD)
The receiving device has its receiver on (RxOnIdle) The data packet can be set unsolicited The MAC schedules it for immediate delivery (using CSMA-CA)
Indirect (FFD
RFD)
The receiving device is asleep with its receiver off The data packet has to be requested (Polled) The FFD MAC stores it for later retrieval by the RFD.
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
10
802.15.4 Summary
Wireless Personal Area Network (WPAN)
Used to convey information over short distances.
Star network topology Devices communicate only with the Coordinator In-direct data transmission enables small, power efficient, inexpensive solutions to be implemented. But 802.15.4 does not provide multi-hop networking 802.15.4 does not provide mesh networking Enter ZigBee
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
11
ZigBee Stack
ZigBee is built upon the foundations provided by the IEEE 802.15.4 standard.
APSSE-SAP NLSE-SAP
Application Framework
ZPUI
Application Object 240
[On Endpoint 240] APSDE-SAP
Application Object 1
[On Endpoint 1] APSDE-SAP
ZigBee Device Object (ZDO)
[On Endpoint 0] APSDE-SAP
APSME-SAP
Security Service Provider
Application Support (APS) Layer
NLDE-SAP
NLME-SAP
Network (NWK) Layer
MCPS-SAP MLME-SAP
Medium Access Layer (MAC) Layer
PD-SAP PLME-SAP
Physical (PHY) Layer
ZigBee Stack
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
12
Architecture: NWK layer details
ZigBee Device Types Stack Profile, Network Rules Network Management and Addressing Message Routing Route Discovery and Maintenance Security
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
13
Architecture: Network Structure in ZigBee
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
14
Architecture: Stack Profile
Sets the rules that the network adheres to:
nwkMaxDepth nwkMaxChildren nwkMaxRouters nwkSecurityLevel
And many more
Table sizes Timeouts Route Cost Calculation Algorithm
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
15
Architecture: ZigBee Device Types
ZigBee Coordinator (ZC)
One and only one required for each ZigBee network.
First one on the scene Selects the time and place (Channel, PANId, Stack Profile)
Initiates network formation.
Acts as IEEE 802.15.4 2003 PAN coordinator (FFD). Also performs as router once network is formed. Not necessarily a dedicated device can
perform an application too.
One extra function: Acts as Bind Request Controller
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
16
Architecture: ZigBee Device Types ZigBee Router (ZR)
Optional network component. Discovers and associates with ZC or ZR.
Extends the network coverage
Acts as IEEE 802.15.4 2003 coordinator (FFD). Manages local address allocation / de-allocation Participates in multi-hop / mesh routing of messages.
Looks after its ZEDs when it comes to broadcasting and routing messages Maintains Neighbor Table to allow Neighbor Routing
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
17
Architecture: ZigBee Device Types ZigBee End Device (ZED)
Optional network component. Discovers and associates with ZC or ZR. Acts as IEEE 802.15.4 2003 device (RFD). Can be optimised for very low power operation Relies on its parent to let it sleep
RxOnIdle is off
Shall not allow association. Shall not participate in routing.
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
18
Network Initiation: ZC NLME_NETWORK_FORMATION.request
Performs an Energy Detect Scan
Looks for other wireless devices on the channel Looks for other 802.15.4 networks on the channel Weights up channels based on noise level and PANs
Performs an Active Scan
Selects the nicest channel
Selects an unused PANId Starts a network
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
19
Network Discovery: ZR & ZED NLME_NETWORK_DISCOVERY.request
Performs an Active Scan
Looks for other ZigBee networks on the channel
Selects a compatible network
Stack Profile
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
20
Network Association: ZR & ZED NLME_JOIN.request
Selects the highest acceptable router
Link Quality, with capacity
Associates with the router Allocated an address on the network
Device authenticates with network
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
21
Network Association: ZR Cont. NLME_START_ROUTER.request
Updates Beacon Payload
Depth, Capacity
Starts a router
Updates Association Permit Status
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
22
Addressing: Tree-structured Address Assignment
CSkip based address assignment Address determined from tree location
Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 0x7FFF 0xFFFF
nwkMaxDepth
nwkMaxChildren
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
23
Transmitting Data NLDE-DATA.request
Used by NHL for all data transmissions
Uni-casts and broadcasts Destination Address Radius Discover Route
Accepts the following parameters
NLDE-DATA.indication
Reports the receipt of a data transmission Includes the following parameters
Source Address
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
24
Tree Routing:
The address tells you where the destination is Simple equation gives route up or route down If LocalAddr < DestAddr < LocalAddr + CSkip(d-1) Route Down Else Route Up
Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 0x7FFF 0xFFFF
CSkip d= 1 CSkip d= 2
Obviously not necessarily the most efficient route
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
25
Neighbour Routing:
A ZC or ZR maintains a table of devices in its neighbourhood If the target device is physically in range it can send the message directly.
Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 0x7FFF 0xFFFF
Devices Neighbourhood
But what happens if the destination is not in the local neighbourhood?
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
26
Mesh Routing:
ZC or ZR maintains a routing table of next hop addresses If the target device has a routing table entry then the message can be sent using this route.
Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 0x7FFF 0xFFFF
Thats great, but where do the routing table entries come from?
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
27
Routing: Route Discovery
A device wishing to discover a route issues a route request
command frame
Specialized broadcast frame transmitted throughout the network. Path cost is computed by intermediary nodes on receipt
Nodes pass on the route request if new or better route request Intended destination responds to the route request command frame
if new or better route request with a route reply command frame
Unicast frame, returns along the reverse path Reports the path cost
Nodes pass on the route reply and update their routing tables
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
28
Message Routing: The Basic Algorithm
1. 2. 3.
See if the destination is in the Neighbour Table Check for a Routing Table entry Finally resort to Tree Routing
NB. ZRs store messages for sleeping ZEDs
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
29
Broadcast: The Basic Algorithm
Transmit broadcast message Rebroadcast by local ZRs if it is new. Time & radius limited. ZRs store messages for sleeping ZEDs ZRs issue broadcasts on behalf of sleeping ZEDs
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
30
Security: NWK Layer
The Stack Profile defines the security level in use. Uses Network Key unless Link Key has been applied. Tool box offers both authentication and encryption facilities. Auxiliary Header and Message Integrity Code add overhead to the packet.
nibSecurityLevel 0 1 2 3 4 5 6 7 Security Suite NONE MIC-32 MIC-64 MIC-128 ENC ENC-MIC-32 ENC-MIC-64 ENC-MIN-128
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
31
Network Layer Management Primitives
NLME-PERMIT-JOINING.request NLME-PERMIT-JOINING.confirm NLME-DIRECT-JOIN.request NLME-DIRECT-JOIN.confirm NLME-LEAVE.request NLME-LEAVE.confirm NLME-LEAVE.indication NLME-SYNC.request NLME-SYNC.confirm NLME-SYNC.indication NLME-RESET.request NLME-RESET.confirm NLME-GET.request NLME-GET.confirm NLME-SET.request NLME-SET.confirm
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
32
To summarise the ZigBee network layer:
Has 3 device types; ZC, ZR and ZED. Performs network discovery and formation Performs address allocation Performs message routing Configured by the stack profile Provides network wide security Allows low power devices to maximize
their battery life
ZigBee turns 802.15.4 into a low power multi-hop mesh network.
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
33
Any Questions
Any Questions
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
34
Contact Details
Ian Marsden Integration UK Ltd Director, Software Engineering
imarsden@integration.com DDI: +44 (0) 1737 227721 Tel: +44 (0) 1737 227722 www.integration.com Cell: +44 (0) 7920 105537 Fax: +44 (0) 1737 227744
16-18 West Street, Reigate, Surrey, RH2 9BS, United Kingdom
ZigBeeTM Alliance | Wireless Control That Simply Works
Copyright 2006. All Rights Reserved.
35