470 likes | 661 Views
‘Under the Hood‘ of a ZigBee 2006 Network. Ian Marsden Chairman ZigBee NWG Director, Software Engineering, Integration Associates. ZPUI. APSDE-SAP. APSDE-SAP. APSDE-SAP. APSSE-SAP. APSME-SAP. NLDE-SAP. NLSE-SAP. NLME-SAP. MCPS-SAP. MLME-SAP. Medium Access Layer (MAC) Layer. PD-SAP.
E N D
‘Under the Hood‘ of a ZigBee 2006 Network Ian Marsden Chairman ZigBee NWG Director, Software Engineering, Integration Associates
ZPUI APSDE-SAP APSDE-SAP APSDE-SAP APSSE-SAP APSME-SAP NLDE-SAP NLSE-SAP NLME-SAP MCPS-SAP MLME-SAP Medium Access Layer (MAC) Layer PD-SAP PLME-SAP Physical (PHY) Layer ZigBee is built upon the foundations provided by the IEEE 802.15.4 standard. Application Framework ZigBee Device Object (ZDO) Application Object 240 Application Object 1 [On Endpoint 240] [On Endpoint 1] [On Endpoint 0] Application Support (APS) Layer Security Service Provider Network (NWK) Layer ZigBee Stack
ZigBee Devices Type Model • Distinguishes the type of device from an end-user perspective Application Device Type e.g.Light Sensor e.g. Lighting Controller ... • Distinguishes the Logical Device Types deployed in a specific ZigBee network ZigBee LogicalDevice Type ZigBee Coordinator ZigBee Router ZigBee End Device • Distinguishes the type of ZigBee hardware platform 802.15.4Device Type FFD – Full Function Device RFD – Reduced Function Device • ZigBee products are a combination of Application, ZigBee Logical, and ZigBee Physical device types • Profiles may define specific requirements for this combination, but can also leave this up to manufacturers
802.15.4 Architecture: • Defines basic network structure • Provides methods for locating networks • Provides methods for joining / rejoining networks • Defines direct / indirect data transmission
Architecture:Network Structure in 802.15.4 802.15.4 FFD 802.15.4 RFD Network Association
MLME_SCAN: Locating Networks • Active Scan • Asks on the requested channels for other PANs • Returns a list of PANDescriptors
MLME_START: Initiating a Network • Starts the requested PAN
MLME_ASSOCIATE: Joining a Network • Associates with the requested coordinator
MLME_SCAN: Rejoining a Network • Orphan Scan • Asks on the requested channels for its former parent
Data Transmission: Direct • 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) In-Direct • The receiving device is asleep with its receiver off • The data packet has to be requested (Polled) • The MAC stores it for later retrieval by the RFD.
Architecture: NWK layer details • ZigBee Device Types • Stack Profile, Network Rules • Network Management and Addressing • Message Routing • Route Discovery and Maintenance • Security
Architecture: Stack Profile Sets the rules that the network adheres to: • nwkMaxDepth = 5 • nwkMaxChildren = 20 • nwkMaxRouters = 6 • nwkSecurityLevel = 5 (ENC-MIC-32) And many more • Minimum Table sizes (Neighbor, Routing) • Timeouts (Broadcast) • Route Cost Calculation Algorithm • Disables features (Multicast, Aggregation routing)
Architecture: ZigBee Device Types ZigBee Coordinator (ZC) • One and only one required for each ZigBee network. • First one to the party • Initiates network formation. • Selects the time and place (Channel, PANId, Stack Profile) • 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.
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 ZED’s when it comes to broadcasting and routing messages
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 • Shall not allow association. • Shall not participate in routing.
Network Initiation: ZC • Initiates a ZigBee network • Performs an Energy Detect Scan • Performs an Active Scan • Selects the “nicest” channel • Selects an unused PANId • Starts a network
Network Discovery: ZR & ZED • Locates ZigBee Networks • Performs an Active Scan • Selects a compatible network
Network Association: ZR & ZED • Join a ZigBee Network • Selects the highest acceptable router • Associates with the chosen router • Allocated an address on the network • Inform the NHL
Commencing Router Function: ZR • Commence Router Function • Once authenticated on the network • Prepares addresses for its children • Starts up the router function
Addressing:Tree-structured Address Assignment • CSkip based address assignment • Address determined from tree location 0xFFFF 0x7FFF Address 0x0 Depth 0 Depth 1 nwkMaxDepth Depth 2 Depth 3 nwkMaxChildren
Sending Data • Used by the NHL for sending broadcasts and unicasts • DstAddr defines the target device • Radius limits the number of hops for the message to traverse, if appropriate • DiscoverRoute can inhibit discovery
Receiving Data • Created on reception of data for the local device • SrcAddr is the originator of the message
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 0xFFFF 0x7FFF Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 Obviously not necessarily the most efficient route CSkip d= 1 CSkip d= 2
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. 0xFFFF 0x7FFF Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 Devices Neighbourhood But what happens if the destination is not in the local neighbourhood?
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. 0xFFFF 0x7FFF Address 0x0 Depth 0 Depth 1 Depth 2 Depth 3 That’s great, but where do the routing table entries come from?
Routing: Route Discovery • A device wishing to discover a route issues a route request command frame which is broadcast throughout the network. • When the intended destination receives the route request command frame it responds with a route reply command frame. • Potential routes are evaluated with respect to a routing cost metric. • Best route is added to the routing tables of all devices on the route
Message Routing: The Basic Algorithm • 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 ZED’s
Broadcast: The Basic Algorithm • Transmit broadcast message • Rebroadcast by local ZRs if it is new. • Time & radius limited. • ZRs store messages for sleeping ZED’s • ZRs issue broadcasts on behalf of sleeping ZEDs
NLME-PERMIT-JOINING • Enable or Disable devices joining • Opens up a ZC or ZR for a possibly limited duration to new devices associating • Sets or clears the AssociationPermit status • PermitDuration in seconds 0 = Disable, 0xFF = Infinite
Network Orphaning: ZR & ZED • Rejoin a previous Parent • Performs an 802.15.4 Orphan Scan • Previous parent will respond
Network Rejoining: ZR & ZED • Rejoin a network (New Parent) • Performs an Active scan to find out who is out there • Selects new parent with capacity
NLME-DIRECT-JOIN • Pre-join a device to a ZR or ZC • Enables the device to join later through orphaning • The CapabilityInformation is as the device would provide
NLME-LEAVE • Controls the removal of devices from a network • Allows a device to leave itself (DeviceAddress = NULL) • Allows a device to request a child to leave • RemoveChildren defines if the children below the leaving device should also leave • Rejoin defines if the leave is a transient effect and the device should attempt to rejoin
NLME-SYNC • Controls the receiving of data on a ZED • Requests a ZED to issue an MLME-POLL.request to its parent
NLME-RESET • Returns the stack to a known state • In turn calls a MLME-RESET.request
NLME-GET & NLME-SET • Requests the value of configuration parameters from within the NIB • Updates the value of configuration parameters within the NIB
NLME-ROUTE-ERROR • Informs the NHL of some break down in communications • Used if Route Discovery fails • Used if Tree links break • Used if a packet cannot be delivered • Etc.
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.
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.
Contact Details: Ian Marsden Integration UK Ltd Director, Software Engineering mailto:imarsden@integration.com DDI: +44 (0) 1737 227721 Cell: +44 (0) 7920 105537 Tel: +44 (0) 1737 227722 Fax: +44 (0) 1737 227744 16 - 18 West Street, Reigate, Surrey, RH2 9BS, United Kingdom http://www.integration.com