Content Lecture 6 ZigBee Device Object (ZDO) and Network Layer (NWK) ZDO general introduction ZDO function description Device discovery Service discovery Binding service Management service Jingcheng Zhang Linköping University 2013-01-28 ZigBee create, join, rejoin network ZigBee address assignment ZigBee packet routing ZigBee OTA frames ZigBee stack profiles 1 2 Z-Stack ZDO Interface ZDO general introduction ZDO is an endpoint (Mandatory) The ZigBee Device Object (ZDO, shown in Figure 5.1 ) is simply the application running on endpoint 0 in every ZigBee device. ZDO function keeps track of the state of the ZigBee device on and off the network provides an interface to the ZigBee Device Profile (ZDP) Discover network Configure network Maintain network ZDP is the profile that is utilized by ZDO. Commands are Client / Server based. 3 4 1
ZDO Device Discovery - How does the physical device looks like? ZDO Service Discovery - Show what the device can do 5 6 ZDO Service Discovery Command Introduction Simple_Desc_Req: Get simple descriptor from the peer node Get response by registering the callback of Simple_Desc_Rsp Rsp Active_EP_Req Get the list of Endpoint IDs of the active endpoint Get response as the endpoint ID list by registering the callback of Actvie_EP_Rsp Match_Desc_Req Get the endpoint ID list which includes the match result of the provided cluster information within the whole network Get response by registering the Match_Desc_Rsp callback Use case scenario - Collect ZigBee network information Collect the network address information using NWK_ADDR_REQ REQ (Device discovery) For each device, issue Active_EP_Req to get the active endpoint list For each endpoint, issue Simple_Desc_Req to get the descriptor of each endpoint 7 8 2
ZDO Binding Management Binding Application Binding provides a mechanism for attaching an endpoint on one node to one or more endpoints on another node. Binding can even be destined for groups of nodes. Then, when using APSDE-DATA DATA.request, simply use the indirect addressing mode, and the request will be sent to each endpoint or group listed in the local binding table. EP1 EP2 EP8 EP3 EP4 Binding is an address management method. EP5 EP9 Application layer does not need to remember e the destination address after binding process. EP7 EP10 Binding is one-direction. EP6 9 10 ZDO Binding Table ZDO Binding Commands A system-wise table that records all binding related information of the DEVICE 11 12 3
ZDO Management Service - Network creation ZigBee Coordinators (ZCs) form networks. Determine a unique identifier for the network, called a PAN ID. Choose one of the sixteen 802.15.4 channels (11 26) ZigBee Table Management Services in ZDP: Mgmt_Lqi_req the neighbor table Mgmt_Rtg_req the routing table Mgmt_Bind_req the (optional) binding table 13 It forms a network. It establishes the 802.15.4 channel on which the network will operate. It establishes the extended and short PAN ID for the network. It decides on the stack profile to use (compile or run-time option). It acts as the Trust Center for secure applications and networks. It acts as a router for mesh routing. It acts as the top of the tree, if tree routing is enabled. 14 - Active scan and energy scan during network creation - Join the network ZigBee Routers are responsible for: Finding and joining the correct network Perpetuating broadcasts across the network Participating in routing, including discovering and maintaining routes Allowing other devices to join the network (if permit-join enabled) Storing packets on behalf of sleeping children 15 ZigBee End-Devices are responsible for: Finding and joining the correct network Polling their parents to see if any messages were sent to them while they were asleep Finding a new parent if the link to the old parent is lost (NWK rejoin) Sleeping most of the time to conserve batteries when not in use by the application. 16 4
- Join the network OTA frames - Message forwarding and topology relationship Keep in mind this parent/child relationship has nothing to do with mesh routing. A router may route through any other router within hearing range on the same network. All ZigBee Routers (and the ZC) are peers in this respect. If arouter s parent or child goes away (perhaps even leaving the network) no harm is done to routes, other than to those specific devices (assuming a network has sufficient density). To ZigBee End-Devices, however, the parent/child relationship is very special. ZEDs, while they can communicate to any node on the network, communicate only to their parent directly. Another way to put it is that the next hop of a ZED is always to its parent. If a ZED loses the link with its parent, it must (at some point) find another parent in order to keep communicating on the network, a process called rejoining. 17 18 - Device rejoin process - Address assignment Cskip Defined in ZigBee Stack profile 0x01 Calculate network address using Cskip expression with three parameters maxdepth maxchildren and maxrouters Stochastic Defined in ZigBee pro Stack profile 0x02 Device join network with own address Send device announcement Change to another address once conflict 19 20 5
- Routing methods ZigBee employs a variety of methods for routing packets from one node to another: Broadcasting (from one to many nodes) Mesh routing (unicast from one node to another) Tree routing (unicast from one node to another, stack profile 0x01 only) Source routing (unicast from one node to another, stack profile 0x02 only) - Broadcasting Radius: Determines how many repetitions for one BCD message Can be set to 0x00 indicating to send the message within the entire network Broadcasting destination Mode: 0xFFFF: Forward the message to all devices 0xFFFC: Forward the message to all routers 0xFFFD: Forward the message to all EX_IDLE_ON = TRUE 21 Broadcast messages: Match_EP_Req, Route_Req, ED_Announce 22 -ZigBeemesh - ZigBee mesh AODV Route request The algorithm is based on the publicly available Advanced Ad-hoc On-Demand Distance Vectoring (AODV). All routers are peers. The route is distributed: Each node in the route keeps track of the next hop for the route in a routing table. Routes are unidirectional (a route must be discovered each way for bidirectional communication). Routes are like goat trails: they continue to be used until they fail. Failed routes are communicated back to the originating node, allowing it to discover a new route. 23 The originator broadcasts the route request. The route request adds link cost after each hop. The Link cost is not the same as the hop (always 1), it might be bigger than 1 when the link quality is low. The route with the lowest link cost wins. 24 6
- ZigBee mesh AODV Route response - ZigBee mesh reroute 25 26 - Routing table - Stack Profile Stack profile 0x01, also called ZigBee 2006, ZigBee 2007, or just plain ZigBee, is the original ZigBee stack profile. Predictable address assignment Tree and mesh routing Smaller code size Up to 10 hops in the network If finding a route to a ZED, the router parent will respond on the end device s behalf. The ZED doesn t need to know anything about routes: It simply receives packets from its parent and sends packets to its parent. 27 Stack profile 0x02, also called ZigBee Pro, is a later addition to ZigBee, added in the 2007 specification. Random (stochastic) address assignment Source routing Multicast Larger code size Up to 30 hops in the network Both stack profiles support unicasting, broadcasting, groups, endpoints, clusters, the ZigBee public application profiles, and ZDO. 28 7
Tack så mycket! www.liu.se 29 8