330 likes | 872 Views
The ZigBee Networking Layer. Speaker : Chang Kai-Jia Date : 2010/5/26. Contents. ZigBee and IEEE 802.15.4 Forming, Joining, and Rejoining ZigBee Networks Forming Networks Joining Networks Rejoining Networks ZigBee Address Assignment Broadcasts Mesh Routing ZigBee Over-the-Air Frames
E N D
The ZigBee Networking Layer Speaker : Chang Kai-Jia Date : 2010/5/26
Contents • ZigBee and IEEE 802.15.4 • Forming, Joining, and Rejoining ZigBee Networks • Forming Networks • Joining Networks • Rejoining Networks • ZigBee Address Assignment • Broadcasts • Mesh Routing • ZigBee Over-the-Air Frames • ZigBee Stack Profiles
MLME: • MLME ( Media Access Control (MAC) sublayer Management Entity) • 若裝置為協調者則產生訊標(beacon); • 普通裝置根據訊標訊框來與協調者達到同步(synchronizing); • 提供PAN網路聯結(association)和取消聯結(disassociation)功能; • 提供裝置資料加密安全性(security); • 使用載波檢測多重存取/碰撞避免(CSMA/CA)機制來競爭通道; • 支援保證時槽(guaranteed time slots;GTSs)之機制; • 在不同的媒介存取控制副層間提供可靠傳輸(reliable link);
NLDE&NLME: • 網路層資料訊息通道(Network Layer Data Entity , NLDE) • a. 將APL 所傳來的資料(APDU)轉成Network level PDU (NPDU) • b. 根據網路的拓樸架構決定資料訊框路由的路徑。 • 網路層管理訊息通道(Network Layer Management Entity , NLME) • 設定網路參數包含以及設備參數 • 負責初始化及建立一新的ZigBee 網路 • 加入或是離開一網路 • ZigBee 網路協調者以及路由器負責配發網路位址給新加入網路的終端點,尋找並且記錄鄰近網路設備的所有資訊 • 尋找並且記錄網路封包路由路徑
ZigBee and IEEE 802.15.4 • IEEE 802.15.4 defines: • Mechanisms for discovering networks • Mechanisms for forming and joining networks • Mechanisms for changing channels • Mechanisms for detecting interference and “ noise ” on a particular channel • An acknowledged, single-hop, data-packet delivery method, using CSMA-CA to avoid collisions • Carrie Sense Multiple Access with Collision Avoidance(CSMA/CA): 先產生一個隨機的延遲時間 (Random Backoff Time)。延遲時間直到確認頻道是空閒的再繼續計算。直到延遲時間到再進行下一步。 在發出資料前,先發出 RTS (Request To Send) 的通知訊號,目的端收到 RTS 訊號後必須要回應 CTS (Clear To Send) 的訊號。發送端收到 CTS 訊號後才把資料發送出去。
Forming, Joining, and Rejoining ZigBee Networks • Starts out with a unique 64-bit IEEE address • Joining the network, each node is assigned a unique (within that network) 16-bit short address. ZED ZC ZR ZED ZED ZR ZED
Forming Networks • ZigBee Coordinator has the following duties: • 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 the arbiter for End-Device-Bind (a commissioning option). • It acts as a router for mesh routing. • It acts as the top of the tree, if tree routing enabled.
Channel scan: • (1) 能量檢測通道搜尋(energy detection channel scan):完全功能裝置(FFD)要形成ZigBee個人區域網路時所執行的,讓FFD得知每一個所搜尋頻道上的最高峰之能量。 • (2) 主動頻道搜尋(active channel scan):在無信標環境下讓裝置能尋找出所有相鄰之協調器或路由器之狀態。 • (3) 被動頻道搜尋(passive channel scan):與主動頻道搜尋目的相同,主要在信標環境下只做接收信標訊號之搜尋方式。 • (4) 孤兒頻道搜尋(orphan channel scan):裝置發生同步遺失(synchronization loss)狀態時,搜尋所有頻道來尋找已建立連線之父節點(協調器或路由器)。
Joining Networks • 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
Joining Networks • 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.
Rejoining Networks • There are several reasons why a node might need to rejoin the network: • A ZED has lost contact with its parent • Power has been cycled, and many or all nodes in the network rejoin “ silently ” • Joining a secure network if permit-joining is off
ZigBee Address Assignment • 64 bits (8 bytes) • Organizational Unique Identifier (OUI):24 bits • Original Equipment Manufacturer (OEM):40 bits
ZigBee uses one of two address schemes to assign the short address: • Cskip • Cskip address assignment, available in stack profile 0x01 (the stack profile simply called ZigBee) • stack profile 0x01 uses a calculated number for each “ depth ” (the number of hops from the ZigBee Coordinator), called Cskip (child skip). • allows tree routing in addition to mesh. • Stochastic (random) • Stochastic addressing is available in stack profile 0x02 (the stack profile called ZigBee Pro).
Cskip: • collector先定義父節點允許連接所有子節點個數(Cm)、子節點路由器最大個數(Rm)、形成網路最大深度(Lm)及由該父節點路由器網路深度的第d 層,2.1 算出每一層網路深度的Cskip 函數,2.2 得下一個加入子節點(路由器與終端裝置)分配到的網路位址。
ZigBee Packet Routing • 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)
Broadcasts • ZigBee does allow a radius of 0x00, which is a special flag that means to repeat the broadcast for the entire network. • This radius set from 0x01 to 0xff, to indicate an actual maximum distance. • There are three special ZigBee broadcast modes: • 0xffff—broadcast to all nodes (even sleeping ZEDs) • 0xfffd—broadcast to all awake devices (including RxOnIdle =TRUE ZEDs) • 0xfffc—broadcast to all routers (excludes all ZEDs) • Ch4 -ZigBee Applications
Broadcasts • The Broadcast Transaction Table(BTT) is a critical component of broadcasting. • Broadcasting transmits from one node to many nodes, up to the entire network. • Use broadcasts sparingly, as they consume a lot of bandwidth and resources. • Broadcasts are slow compared to unicasts. • Appendix A, “ ZigBee 2007 and ZigBee Pro, “
Broadcast Transaction Table(BTT) • The record that was created actually goes into a table called the Broadcast Transaction Table or BTT. • when a broadcast is transmitted, all devices that receive it will broadcast a copy. • Each time a copy of the broadcast arrives, the address of the sender will be added to the BTT to mark that it has relayed the broadcast. • After a broadcast timeout, if all neighbors haven’t relayed the broadcast, meaning they aren’t present in the BTT, then the original sender will need to do a broadcast retry.
Mesh Routing • In ZigBee mesh: • 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. • Ad hoc On-Demand Distance Vector (AODV):RFC3561
AODV(Ad hoc On-Demand Vector) • 若一個裝置(協調器或路由器)擁有路由表(routing table)與路由找尋表(routing discovery table)則稱為具有路由能力(routing capacity), • 如圖2.11 ,當有路由能力的node 0 要傳送資料到 node 4 時,發現其路由表中並沒有到達目的端node 4 的路由時,將會發送廣播訊息RREQ(Route request)來啟動路由尋找機制(routing discovery)。 • 當裝置2 接收到RREQ 訊息時會先計算與來源端之間的link cost,並且記錄到RREQ 訊息內,若該裝置2 接收到相同目的端訊息RREQ,將會保留最低link cost 的路由。 • 由於裝置2 並沒有路由能力,因此將使用樹狀網路機制發送詢問訊息RREQ 給node 4,此時目的端node 4 則按照下一跳躍(next hop)節點的原有路由方式,回傳RREP(Route reply)訊息給來源端node 0,完成路由尋找的程序。
Mesh Routing • Routes are discovered automatically by ZigBee. • ZigBee Mesh route discovery is initiated when a node sends a packet to another node. • Routes are discovered along the least cost path.
ZigBee Stack Profiles • Stack profile 0x01 tends to be used in applications where cost is one of the major concerns. Its main characteristics are: • Predictable address assignment • Tree routing • Smaller code size • Up to 10 hops in the network
ZigBee Stack Profiles • Stack profile 0x02 tends be used where cost is less of an issue, and larger networks are more important. Its main characteristics are: • Random (stochastic) address assignment • Source routing • Multicast • Larger code size • Up to 30 hops in the network
ZigBee Stack Profiles • There are two ZigBee stack profiles: 0x01 (ZigBee) and 0x02 (ZigBee Pro). • Stack Profiles define alternate routing methods and maximum number of hops. • ZigBee nodes may join either stack profile.
Reference: • The Handoff Procedure for Real Time Voice Communication in ZigBee Environment • Efficient Mechanism for GTS Allocation (EMGA) inIEEE 802.15.4 LR-WPAN