天天看點

【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)

文章目錄

      • 寫在前面
      • 1. zigbee路由概念
        • 1.1、概念
          • 1.1.1 路由表
          • 1.1.2 廣播路由
          • 1.1.3 多點傳播路由
          • 1.1.4 Many-to-One/源路由表
        • 1.2、使用link status來提升路由性能
          • 1.2.1 Description of Relevant Neighbor Table Fields
          • 1.2.2 信号鍊路品質幀(Link Status)
          • 1.2.3 網絡層如何使用雙向成本
          • 1.2.4 Key Concept: Rapid Response
          • 1.2.5 Key Concept: Connectivity Management
        • 1.3 Route Discovery & Repair
          • 1.3.1 Route Discovery
          • 1.3.2 Route Repair
        • 1.4 重發和應答
          • 1.4.1 MAC重試和ACK
          • 1.4.2 NWK重試
          • 1.4.3 APS重試和确認
          • 1.4.4 結論
      • 2、Zigbee協定棧
        • 2.1 Zigbee裝置對象(ZDO)
          • 2.1.1 ZDO進階用法
        • 2.2 Zigbee Profiles
        • 2.3 Zigbee尋址方案
        • 2.4 Extended PAN IDs
          • 2.4.1 Use in Scanning / Forming / Joining Process
        • 2.4.2 Choosing an EPID
          • 2.4.3 EPID與PID對比

寫在前面

  • 索引
    • 【ember zigbee】序章:協定棧相關文檔學習筆記
    • 【ember zigbee】第二章:ug103-02-fundamentals-zigbee 學習筆記(上)
    • 【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
    • 【ember zigbee】第四章:ug103-02-fundamentals-zigbee 學習筆記(下)

1. zigbee路由概念

1.1、概念

  Zigbee has several routing mechanisms that can be used based on the network and expected traffic patterns. In Zigbee Specification, document 05-3474, section 3.4 describes the frame format for command frames, and section 3.6.3 describes routing behavior.

  The application designer should choose which mechanism to use as part of the system architecture and design. In actual practice one application may use several of these routing mechanisms, because some devices may be performing one-to-one communications while other devices may be communicating to a central monitoring device. The types of routing discussed below are:

  • Table Routing
  • Broadcast Routing
  • Multicast Routing
  • Many-to-One/Source Routing
  • Zigbee有幾種路由機制,可以根據網絡和預期的流量模式選擇合适的路由機制。 在Zigbee規範中,文檔05-3474的第3.4節描述了指令幀的幀格式,第3.6.3節描述了路由行為。
  • 應用程式設計人員應選擇将哪種機制用作系統體系結構和設計的一部分。 在實際實踐中,一個應用可以使用這些路由機制中的若幹個,因為一些裝置可以執行一對一通信,而其他裝置可以與中央監控裝置通信。 下面讨論的路由類型是:
    • 路由表
    • 廣播路由
    • 多點傳播路由
    • 多對一/源路由
1.1.1 路由表
  Routes are formed when one node sends a route request to discover the path to another node. After a route is discovered between the two nodes, the source node sends its message to the first node in the route, as specified in the source node’s routing table. Each intermediate node uses its own routing table to forward the message to the next node (that is “hop”) along the route until the message reaches its destination. If a route fails, a route error is sent back to the originator of the message who can then rediscover the route.
  • 當一個節點發送路由請求以發現到另一個節點的路徑成功後,就會形成路由。在兩個節點之間發現路由後,源節點将消息發送到路由中的第一個節點,之後的中間節點查找自己的路由表,然後将消息轉發到路由的下一個節點(即“跳”),直到消息到達其目的地。如果路由失敗,則會向消息的發起者發送路由錯誤,然後該發起者可以重新發現路由。
1.1.2 廣播路由
  Broadcast routing is a mechanism to send a message to all devices in a network. Network-level broadcast options exist to send to routers only, to all non-sleeping nodes including end devices, or also to send to sleeping end devices. A broadcast message is repeated by all router-capable devices in the network three times to ensure delivery to all devices. While a broadcast is a reliable means of sending a message, it should be used sparingly because of the impact on network performance. Repeated broadcasts can limit any other traffic that may be occurring in the network. Broadcasts are also not a reliable means of delivery to a sleeping device because the parent device is responsible for buffering the message for the sleeping child but may drop the message before the end device wakes to receive it.
  • 廣播路由是一種向網絡中的所有裝置發送消息的機制。路由廣播的選項有僅發送到路由器、發送到包括終端裝置的所有非休眠節點、或者發送到所有裝置,包含休眠終端裝置。網絡中所有支援路由器的裝置将會重複廣播消息三次,以確定消息傳送到所有裝置。雖然廣播是發送消息的可靠方法,但由于對網絡性能的影響,應謹慎使用廣播。重複廣播可以限制網絡中可能發生的任何其他流量。廣播也不是傳遞給睡眠裝置的可靠方式,因為父裝置雖然會負責緩沖睡眠裝置的消息,但可能在睡眠裝置喚醒接收消息之前,就丢棄該幀消息了。
1.1.3 多點傳播路由
  Multicast routing provides a one-to-many routing option. A multicast is used when one device wants to send a message to a group of devices, such as a light switch sending an on command to a bank of 10 lights. Under this mechanism, all the devices are joined into a multicast group. Only those devices that are members of the group will receive messages, although other devices will route these multicast messages. A multicast is a filtered limited broadcast. It should be used only as necessary in applications, because over-use of broadcast mechanisms can degrade network performance. A multicast message is never acknowledged.
  • 多點傳播路由提供一對多路由選項。 當一個裝置想要向一組裝置發送消息時使用多點傳播,例如向一組10個燈發送燈開啟指令。 在此機制下,所有裝置都加入了多點傳播組。 隻有那些屬于該組成員的裝置才會收到消息,但其他裝置将路由這些多點傳播消息。 多點傳播是過濾的有限廣播。 它應該僅在應用程式中使用時使用,因為廣播機制的過度使用會降低網絡性能。當然,多點傳播消息是不會應答的。
1.1.4 Many-to-One/源路由表

  Many-to-one routing is a simple mechanism to allow an entire network to have a path to a central control or monitoring device. Under normal table routing, the central device and the devices immediately surrounding it would need routing table space to store a next hop for each device in the network, as well as an entry to the central device itself. Given the memory limited devices often used in Zigbee networks, these large tables are undesirable.

  Under many-to-one routing, the central device, known as a “concentrator,” sends a single route discovery that established a single route table entry in all routers to provide the next hop to the central device. This yields a result similar to that of table routing, but with a single many-to-one route request rather than many individual, one-to-one route requests from each router towards the concentrator.

  All devices in the network then have a next hop path to the concentrator and only a single table entry is used. However, often the central device also needs to send messages back out into the network. This would result in a more significant increase in route table size, particularly for those nodes closest to the concentrator, since they are relay points in the concentrator’s many outbound routes to the rest of the network. Instead, incoming messages to the concentrator first use a route record message to store the sequence of hops used along the route. The concentrator then stores these next hop routes in reverse order as “source routes” in a locally held table known as a “source route table”. Outgoing messages include this source route in the network header of the message. The message is then routed using next hops from the network header instead of from the route table. This provides for large scalable networks without increasing the memory requirements of all devices. It should be noted that the concentrator requires some additional memory if it is storing these source routes.

  • 多對一路由是一種簡單的機制,允許整個網絡具有到中央控制或監視裝置的路徑。在正常的路由表中,中央裝置及其周圍的裝置将網絡中每個裝置的下一跳存儲到路由表空間來,以及中央裝置本身的入口。考慮到Zigbee網絡中經常使用的存儲器容量受限,這些大型表的存儲通常是是不被歡迎的。
  • 在多對一路由下,中央裝置被稱為“集中器”,它發送一個單一的路由發現,在所有路由器中建立一個單一的路由表條目,以提供中央裝置的下一個跳轉。這産生類似于路由表的結果,但是,使用單個多對一路由請求而不是從每個路由器向集中器的一對一路由請求。
  • 然後,網絡中的所有裝置都具有到集中器的下一跳路徑,并且僅使用單個表條目。但是,中央裝置通常還需要将消息發送回網絡。這将導緻路由表大小的更顯着增加,特别是對于最靠近集中器的那些節點,因為它們是集中器的許多到達網絡其餘部分的出站路由中的中繼點。相反,到集中器的傳入消息首先使用路由記錄消息來存儲沿路由使用的跳躍序列。然後,集中器以相反的順序将這些下一跳路由存儲為本地保持的表中的“源路由”,稱為“源路由表”。傳出消息包括消息的網絡頭中的此源路由。然後使用網絡标頭中的下一跳而不是路由表來路由消息。這提供了大型可擴充網絡,而不會增加所有裝置的記憶體要求。應該注意,如果存儲這些源路由,則集中器需要一些額外的存儲器。

1.2、使用link status來提升路由性能

  The information in this section is provided for those wishing to understand the details of the network layer’s operation, which can prove useful during troubleshooting. Otherwise, link status messages are handled automatically by the stack and application writers need not be concerned with it.

  Links in wireless networks often have asymmetrical link quality due to variations in the local noise floor, receiver sensitivity, and transmit power. The routing layer must use knowledge of the quality of links in both directions in order to establish working routes and to optimize the reliability and efficiency of those routes. It can also use the knowledge to establish reliable two-way routes with a single discovery.

  Zigbee routers keep track of inbound link quality in the neighbor table, typically by averaging LQI (Link Quality Indicator) measurements made by the physical layer. To handle link asymmetry, the Zigbee PRO stack profile specifies that routers obtain and store costs of outgoing links as measured by their neighbors. This is accomplished by exchanging link status information through periodic one hop broadcasts, referred to as “link status” messages. The link status algorithm is explained below, as implemented in EmberZNet PRO.

  • 本節中的資訊是為那些希望了解網絡層操作細節的人提供的,這在故障排除過程中非常有用。通常來說,連結狀态消息應由堆棧自動處理,應用程式編寫者無需關心它。
  • 在無線網絡中,由于噪聲、接收器靈敏度和發射功率的變化,鍊路品質往往是不對稱(A的信号B能接收到,B的信号A接收不到)。路由層必須利用雙向鍊路品質來建立工作路由,并優化這些路由的可靠性和效率。并通過一次發現建立可靠的雙向路由。
  • Zigbee路由器通常通過平均實體層進行的LQI(鍊路品質訓示器)測量來跟蹤鄰居表中的入站鍊路品質。為了處理鍊路不對稱,Zigbee PRO堆棧配置檔案指定路由器擷取并存儲由其鄰居測量的傳對外連結路的成本。這是通過周期性的一跳廣播交換鍊路狀态資訊來實作的,稱為“鍊路狀态”消息。下面解釋鍊路狀态算法,如EmberZNet PRO中所實作的。
1.2.1 Description of Relevant Neighbor Table Fields
  Zigbee routers store information about neighboring Zigbee devices in a neighbor table. For each router neighbor, the entry includes the following fields:
  • average incoming LQI
  • outgoing cost
  • age

  The incoming LQI field is an exponentially weighted moving average of the LQI for all incoming packets from the neighbor. The incoming cost for the neighbor is computed from this value using a lookup table.

  The outgoing cost is the incoming cost reported by the neighbor in its neighbor exchange messages. An outgoing cost of 0 means the cost is unknown. An entry is called “two-way” if it has a nonzero outgoing cost, and “one-way” otherwise.

  The age field measures the amount of time since the last neighbor exchange message was received. A new entry starts at age 0. The age is incremented every EM_NEIGHBOR_AGING_PERIOD, currently 16 seconds. Receiving a neighbor exchange packet resets the age to EM_MIN_NEIGHBOR_AGE, as long as the age is already at least EM_MIN_NEIGHBOR_AGE (currently defined to be 3). This makes it possible to recognize nodes that have been recently added to the table and avoid evicting them, which reduces thrashing in a dense network. If the age is greater than EM_STALE_NEIGHBOR (currently 6), the entry is considered stale and the outgoing cost is reset to 0.

  • Zigbee路由器在鄰居表中存儲有關鄰近Zigbee裝置的資訊。對于每個路由器鄰居,該條目包括以下字段:
    • 資料接收的平均鍊路品質
      • 傳入的LQI字段是來自鄰居的所有傳入分組的LQI的指數權重移動平均值。 使用查找表從該值計算鄰居的傳入成本。
    • 資料發送所需要的能量
      • 傳出成本是鄰居與鄰居之間交換消息中報告的傳入成本。輸出成本為0表示成本未知。如果一個條目的輸出成本不為零,則稱為“雙向”,否則稱為“單向”。
    • 鄰居表的有效時間
      • age字段測量自上次鄰居交換消息收到以來的時間量。 新條目從0歲開始。年齡增加EM_NEIGHBOR_AGING_PERIOD,目前為16秒。 隻要年齡已經至少為EM_MIN_NEIGHBOR_AGE(目前定義為3),接收鄰居交換資料包會将年齡重置為EM_MIN_NEIGHBOR_AGE。 這使得可以識别最近添加到表中的節點并避免驅逐它們,這減少了密集網絡中的颠簸。 如果年齡大于EM_STALE_NEIGHBOR(目前為6),則該條目被視為陳舊,并且傳出成本将重置為0。(ps:age字段會通過接收到新的link status來将age重新置0,如果太久沒收到鄰居發來的link status 時,就預設為老舊的鄰居,再發現新鄰居的時候,就會将舊鄰居剔出。)
1.2.2 信号鍊路品質幀(Link Status)

  Routers send link status messages every 16 seconds plus or minus 2 seconds of jitter. If the router has no two-way links it sends them eight times faster. The packet is sent as a one-hop broadcast with no retries. In the EmberZNet PRO stack, they are sent as Zigbee network command frames.

  The payload contains a list of short IDs of all non-stale neighbors, along with their incoming and outgoing costs. The incoming cost is always a value between 1 and 7. The outgoing cost is a value between 0 and 7, with the value 0 indicating an unknown outgoing cost. For frame format details, refer to the Zigbee specification. Link status messages are also automatically decoded by the Simplicity Studio Network Analyzer for easy reference.

  Upon receipt of a link status message, either a neighbor entry already exists for that neighbor, or one is added if there is space or if the neighbor selection policy decides to replace an old entry with it. If the entry does not get into the table, the packet is simply dropped. If it does get in, then the outgoing cost field is updated with the incoming cost to the receiving node as listed in the sender’s neighbor exchange message. If the receiver is not listed in the message, the outgoing cost field is set to 0. The age field is set to EM_MIN_NEIGHBOR_AGE.

  • 路由器每16秒(±2s)發送鍊路狀态消息。如果路由器沒有雙向鍊路,它将發送速度提高八倍。資料包作為單跳廣播發送,不重試。在EmberZNet PRO堆棧中,它們作為Zigbee網絡指令幀發送。
  • 有效負載(payload)包含所有非陳舊鄰居的短ID清單,以及它們的傳入和傳出成本。傳入成本始終為1到7之間的值。傳出成本是0到7之間的值,值0表示未知的傳出成本。有關幀格式的詳細資訊,請參閱Zigbee規範。連結狀态消息也由Simplicity Studio網絡分析儀自動解碼,以便于參考。
  • 在接收到鍊路狀态消息時,該鄰居已經存在鄰居條目,或者如果存在空間或者鄰居選擇政策決定用它替換舊條目,則添加一個鄰居條目。如果條目沒有進入表中,則隻丢棄資料包。如果确實進入,則輸出成本字段将根據發送方的鄰居交換消息中列出的接收節點的傳入成本進行更新。如果消息中未列出接收方,則輸出成本字段将設定為0.年齡字段設定為EM_MIN_NEIGHBOR_AGE。
1.2.3 網絡層如何使用雙向成本

  As mentioned above, the routing algorithm makes use of the bidirectional cost information to avoid creating broken routes, and to optimize the efficiency and robustness of established routes. For the reader familiar with the Zigbee route discovery process, this subsection gives details of how the outgoing cost is used. The mechanism is surprisingly simple, but provides all the benefits mentioned above.

  Upon receipt of a route request command frame, the neighbor table is searched for an entry corresponding to the transmitting device. If no such entry is found, or if the outgoing cost field of the entry has a value of 0, the frame is discarded and route request processing is terminated.

  If an entry is found with non-zero outgoing cost, the maximum of the incoming and outgoing costs is used for the purposes of the path cost calculation, instead of only the incoming cost. This value is also used to increment the path cost field of the route request frame prior to retransmission.

  • 如上所述,路由算法利用雙向成本資訊來避免建立中斷路由,并優化已建立路由的效率和穩健性。 對于熟悉Zigbee路由發現過程的讀者,本小節詳細介紹了如何使用傳出成本。
  • 在接收到路由請求指令幀時,在鄰居表中搜尋對應于發送裝置的條目。 如果沒有找到這樣的條目,或者條目的輸出成本字段具有值0,則丢棄該幀并終止路由請求處理。
  • 如果找到具有非零傳出成本的條目,則傳入和傳出成本的最大值用于路徑成本計算,而不是僅用于傳入成本。 該值還用于在重傳之前遞增路由請求幀的路徑成本字段。
1.2.4 Key Concept: Rapid Response

  Rapid response allows a node that has been powered on or reset to rapidly acquire two-way links with its neighbors, minimizing the amount of time the application must wait for the stack to be ready to participate in routing. This feature is 100% Zigbee-compatible.

  If a link status message is received that contains no two-way links, and the receiver has added the sender to its neighbor table, then the receiver sends its own link status message immediately in order to get the sender started quickly. The message is still jittered by 2 seconds to avoid collisions with other rapid responders. To avoid a chain reaction, rapid responders must themselves have at least one two-way link.

  • 快速響應允許已啟動或重置的節點快速擷取與其鄰居的雙向鍊路,進而最大限度地縮短應用程式必須等待堆棧準備好參與路由的時間。
  • 如果收到的鍊路狀态消息不包含雙向鍊路,并且接收方已将發送方添加到其鄰居表,則接收方立即發送其自己的鍊路狀态消息,以便快速啟動發送方。 該消息仍然被抖動2秒,以避免與其他快速響應者發生沖突。 為了避免連鎖反應,快速反應者必須自己至少有一個雙向聯系。
1.2.5 Key Concept: Connectivity Management
  By nature Zigbee devices are RAM-constrained, but often Zigbee networks are dense. This means that each router is within radio range of a large number of other routers. In such cases, the number of neighbors can exceed the maximum number of entries in a device’s neighbor table. In such cases, the wrong choice of which neighbors to keep can lead to routing inefficiencies or worse — a disconnected network. The EmberZNet PRO stack employs 100% Zigbee-compatible algorithms to manage the selection of neighbors in dense networks to optimize network connectivity.
  • 本質上Zigbee裝置受RAM限制,但Zigbee網絡通常很密集。 這意味着每個路由器都在大量其他路由器的無線電範圍内。 在這種情況下,鄰居的數量可以超過裝置鄰居表中的最大條目數。 在這種情況下,錯誤選擇保留哪些鄰居會導緻路由效率低下或更糟 - 網絡斷開。 EmberZNet PRO堆棧采用100%Zigbee相容算法來管理密集網絡中鄰居的選擇,以優化網絡連接配接。

1.3 Route Discovery & Repair

  Routing in Zigbee is automatically handled by the networking layer, and the application developer usually does not need to be concerned with its behavior. However, it is useful to have a feel for how the network behaves when a route needs to be discovered or repaired.
  • Zigbee中的路由由網絡層自動處理,應用程式開發人員通常不需要關心其行為。 但是,了解在需要發現或修複路徑時網絡的行為方式很有用。
1.3.1 Route Discovery

  Route discovery is initiated when a unicast message is sent from one device to another and there is no pre-existing route.

  We assume that there is no existing route so the networking software will begin the process of route discovery. For simplicity, assume that the routing tables of all devices are blank.

  • 當單點傳播消息從一個裝置發送到另一個裝置并且沒有預先存在的路由時,将啟動路由發現。
  • 我們假設沒有現有路由,是以網絡軟體将開始路由發現過程。 為簡單起見,假設所有裝置的路由表都是空白的。
  For example, assume that device A needs to send a message to device C, as shown in the following figure. Device A will broadcast a message to the entire network asking the device C to reply. This broadcast message also serves to establish a temporary route back to A, as each intermediate device records the device from which it received the message. Routes are updated on intermediate nodes — note that these are temporary entries that have a shorter lifetime than regular entries and are not intended for re-use. Because A is a one-hop neighbor, B and D do not need to store routing information about it.
【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
  • 例如,假設裝置A需要向裝置C發送消息,如下圖所示。 裝置A将向整個網絡廣播消息,要求裝置C回複。 該廣播消息還用于建立傳回A的臨時路由,因為每個中間裝置記錄從其接收消息的裝置。 路由在中間節點上更新 - 請注意,這些是臨時條目,其生命周期比正常條目短,并且不打算重複使用。 因為A是一跳鄰居,是以B和D不需要存儲關于它的路由資訊。

  C could use either B or D as its next hop back to A. Zigbee leaves this choice to the implementation; Silicon Labs uses a weighting algorithm to choose the most apparently reliable next hop.

  When the message reaches device C, C sends a special unicast message (called a Route Response message) back to A using the temporary route constructed in step 1, as shown in the following figure. This message is used by intermediate devices to establish a (permanent) route back to C.

【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
  • C可以使用B或D作為其下一跳回到A. Zigbee将此選擇留給實作; Silicon Labs使用權重算法來選擇最明顯可靠的下一跳。
  • 當消息到達裝置C時,C使用在步驟1中建構的臨時路由将特殊的單點傳播消息(稱為路由響應消息)發送回A,如下圖所示。 中間裝置使用此消息建立(永久)路由傳回C.

  Because C is a one-hop neighbor, B does not need to store routing information about it. D is not involved in this part of the discovery process because it was not selected by A in the above step. When the message reaches device A, the route discovery is complete and the new route can be used to send data messages from A to C.

  Zigbee PRO networks will detect asymmetric RF links and avoid them during route discovery. This improves the reliability of the discovery process and the resulting routes.

  • 由于C是單跳鄰居,是以B不需要存儲有關它的路由資訊。 D不參與發現過程的這一部分,因為在上述步驟中A沒有選擇它。 當消息到達裝置A時,路由發現完成,新路由可用于從A到C發送資料消息。
  • Zigbee PRO網絡将檢測非對稱RF鍊路并在路由發現期間避免它們。 這提高了發現過程和結果路由的可靠性。

  Routes that have not been used within a certain timeout period (1 minute in EmberZNet 3.0 and later) are marked for re-use and new routes may then overwrite that memory location. In some cases a new route may be needed and one or more intermediate devices will not have an available routing table entry; in this case the message will be reported as undeliverable to the sending node.

  The application specifies if an end-to-end acknowledgment should be sent by the receiver (this is called an APS acknowledgment). If yes, the sender will be notified upon successful delivery of in the case of a timeout waiting for acknowledgment. In the case of a timeout, the route may need to be repaired.

  • 在特定逾時期限内(EmberZNet 3.0及更高版本中為1分鐘)未使用的路由标記為可重複使用,然後新路由可能會覆寫該記憶體位置。 在某些情況下,可能需要新的路由,并且一個或多個中間裝置将不具有可用的路由表條目; 在這種情況下,消息将被報告為無法傳送到發送節點。
  • 應用程式指定接收方是否應發送端到端确認(這稱為APS确認)。 如果是,則在逾時等待确認的情況下成功傳遞時将通知發送方。 在逾時的情況下,可能需要修複路由。
1.3.2 Route Repair
  When a unicast message is sent with an acknowledgment requested, the sending device will be informed when the message is successfully delivered. If does not receive this acknowledgment, it can then take steps to repair the route. Route repair follows exactly the same steps as route discovery, above, but the damaged node (B, in the following figure) does not participate, resulting in a different route choice.
【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
  • 當發送單點傳播消息并請求确認時,将在消息成功傳遞時通知發送裝置。 如果沒有收到此确認,則可以采取措施修複路由。 路由修複遵循與上面的路由發現完全相同的步驟,但是受損節點(下圖中的B)不參與,導緻不同的路由選擇。
  The routing table for A is updated to reflect that the next hop is D and the message is successfully delivered along the new path, as shown in the following figure.
【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
  • 更新A的路由表以反映下一跳是D并且消息沿新路徑成功傳遞,如下圖所示。

  If no alternative path is available, the sender is informed that the message could not be delivered. In EmberZNet PRO this is denoted by a response with EmberStatus of EMBER_DELIVERY_FAILED (0x66).

  EmberZNet PRO will attempt to deliver a message again before performing the route repair. Route repair is performed automatically when EMBER_APS_OPTION_RETRY and EMBER_APS_OPTION_ENABLE_ROUTE_DISCOVERY are both set in the message options.

  • 如果沒有可用的替代路徑,則會通知發件人無法傳遞郵件。 在EmberZNet PRO中,這由EmberStatus的響應表示為EMBER_DELIVERY_FAILED(0x66)。
  • 在執行路徑修複之前,EmberZNet PRO将嘗試再次發送消息。 在消息選項中設定EMBER_APS_OPTION_RETRY和EMBER_APS_OPTION_ENABLE_ROUTE_DISCOVERY時,将自動執行路徑修複。

1.4 重發和應答

  Zigbee and its underlying network layers provide a system of retries and acknowledgments that are designed to efficiently manage the uncertainty of RF communication. It is not necessary to understand this concept in order to start using Zigbee but it may be of interest to some application developers in specific situation.

  This section discusses retries and acknowledgments layer-by-layer:

  • MAC retries and ACKs (802.15.4)
  • NWK retries (Zigbee NWK layer)
  • APS retries and ACKs (Zigbee APS layer)
  • Zigbee及其底層網絡層提供了重試和确認系統,旨在有效地管理RF通信的不确定性。 為了開始使用Zigbee,沒有必要了解這個概念,但在特定情況下,某些應用程式開發人員可能會對此感興趣。
    • MAC重試和ACK(802.15.4)
    • NWK重試(Zigbee NWK層)
    • APS重試和确認(Zigbee APS層)
1.4.1 MAC重試和ACK
The following figure illustrates the MAC layer transmission retry process.
【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
  The MAC layer attempts transmission five times.
  • Unicast retries will occur if the channel was not clear (CCA fail) or if the MAC level ACK was not received from the next hop destination.
  • Broadcast retries will occur in the case of CCA failure but broadcast does not use the MAC ACK capability.
  These retries occur very quickly — maximum retry time for complete failure is approximately 37 ms. Note that the MAC ACK is sent back immediately from the sender without additional CCA — see 802.15.4 documentation for more information.
  • MAC層嘗試傳輸五次。
    • 如果信道未清除(CCA失敗)或未從下一跳目的地接收到MAC級别ACK,則将發生單點傳播重試。
    • 在CCA故障的情況下将發生廣播重試,但是廣播不使用MAC ACK能力。
  • 這些重試非常快速 - 完全失敗的最大重試時間約為37 ms。 請注意,MAC ACK會立即從發送方發回,而無需額外的CCA - 有關詳細資訊,請參閱802.15.4文檔。
1.4.2 NWK重試
  NWK retries in Zigbee are vendor specific. The following figure illustrates the EmberZNet PRO stack’s NWK layer transmission retry process.
【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)
  • NWK在Zigbee的重試對于每個供應商的有所不同。 下圖說明了EmberZNet PRO堆棧的NWK層傳輸重試過程。

  The NWK retries occur only if the MAC layer indicates a transmission failure. They operate on a longer time scale than MAC retries and therefore give the network additional robustness in the presence of medium term (1-500 ms) interference.

  Silicon Labs’ interference research shows that the NWK layer retries are important for overcoming temporary interference from WiFi in certain situations.

  Unicast: unicast behavior is as described in the flow chart, with retries for up to 500 ms.

  • Broadcast: broadcast messages are re-sent every 500 ms up to a total of 3 times (including the initial broadcast) or until all neighbors are heard to rebroadcast the message themselves (thereby ensuring complete delivery)
  • 隻有當MAC層訓示傳輸失敗時,才會發生NWK重試。 它們在比MAC重試更長的時間範圍内運作,是以在存在中期(1-500 ms)幹擾的情況下為網絡提供額外的穩健性。
  • Silicon Labs的幹擾研究表明,在某些情況下,NWK層重試對于克服來自WiFi的臨時幹擾非常重要。
    • 單點傳播:單點傳播行為如流程圖所述,重試時間最長為500毫秒。
    • 廣播:廣播消息每500毫秒重新發送一次,共計3次(包括初始廣播)或直到聽到所有鄰居自己重播消息(進而確定完整傳送)
1.4.3 APS重試和确認
下圖說明了APS層重試過程。
【ember zigbee】第三章:ug103-02-fundamentals-zigbee 學習筆記(中)

  The APS layer has an ACK flag that controls whether it uses the additional logic to wait for an acknowledgment and retry if the acknowledgment is not heard. This represents a full end-to-end acknowledgment from the recipient device.

  The APS layer can be further optionally configured to repair the route to the destination in the case that the APS sending fails.

  There is no equivalent of the APS end-to-end acknowledgment for broadcast messages.

  • APS層有一個ACK标志,用于控制是否使用附加邏輯等待确認,如果未聽到确認則重試。 這表示來自接收方裝置的完整端到端确認。
  • APS層可以進一步可選地配置為在APS發送失敗的情況下修複到目的地的路由。
  • 對廣播消息不需要APS端到端确認。
1.4.4 結論

  If it is possible to send a message to the destination, the automatic Zigbee behavior provides “maximum effort”, by attempting retries over several different time scales, from 1 ms to several seconds with optional end-to-end ACK and route repair.

  If the delivery fails, the application is recommended to wait a more significant amount of time before retrying — this gives the interference or failure time to clear up. In cases of extreme bandwidth congestion the application retries may actually contribute to the problem.

  • 如果可以向目的地發送消息,則自動Zigbee行為通過嘗試在幾個不同的時間尺度上重試,從1毫秒到幾秒,通過可選的端到端ACK和路由修複,提供“最大努力”。
  • 如果傳遞失敗,建議應用程式在重試之前等待更長的時間 - 這會給幹擾或故障時間清除。 在極端帶寬擁塞的情況下,應用程式重試實際上可能導緻問題。

2、Zigbee協定棧

  Zigbee provides several separate stacks. This has been a point of confusion so the summary is as follows:
  • Zigbee 2004 – was released in 2004 and supported a home control lighting profile. This stack was never extensively deployed with customers and is no longer supported.
  • Zigbee 2006 – was released in 2006 and supports a single stack known as the Zigbee stack (explained below)
  • Zigbee 2007 – was released in Q4 2007. It has two feature sets, Zigbee and Zigbee PRO.

The Zigbee and Zigbee PRO stacks are complete implementations of the MAC, networking layer, security services and the application framework. Devices implementing Zigbee and Zigbee PRO can interoperate by acting as end devices in the other type of network. For example, if a network is formed around a Zigbee PRO coordinator it can have Zigbee PRO routers only, but both Zigbee and Zigbee PRO end devices.

  Note: The Zigbee 2004 stack is not interoperable with Zigbee 2007.

  • Zigbee提供了幾個獨立的堆棧。 這一點令人困惑,是以摘要如下:
    • Zigbee 2004 - 于2004年釋出,支援家庭控制照明配置檔案。 此堆棧從未與客戶廣泛部署,不再受支援。
    • Zigbee 2006 - 于2006年釋出,支援稱為Zigbee堆棧的單個堆棧(如下所述)
    • Zigbee 2007 - 于2007年第四季度釋出。它有兩個功能集,Zigbee和Zigbee PRO。
  • Zigbee和Zigbee PRO堆棧是MAC,網絡層,安全服務和應用程式架構的完整實作。 實作Zigbee和Zigbee PRO的裝置可以作為其他類型網絡中的終端裝置進行互操作。 例如,如果在Zigbee PRO協調器周圍形成網絡,它隻能有Zigbee PRO路由器,但Zigbee和Zigbee PRO終端裝置都可以。

    注意:Zigbee 2004堆棧不能與Zigbee 2007互操作。

  The Zigbee stack is formed around a central coordinator and uses tree addressing to establish the network.

  The Zigbee PRO stack is formed around a central coordinator but uses a stochastic addressing scheme to avoid limitations with the tree. Table routing is always used and additional features are available such as:

  • Network level multicasts
  • Many-to-one and source routing
  • Frequency agility
  • Asymmetric link handling
  • PAN ID Conflict
  • Fragmentation
  • Standard or high security.

Silicon Labs does not recommend deploying systems on the Zigbee stack because the Zigbee PRO stack has a number of features that are necessary for long term network stability and reliability. The Zigbee stack is typically used for small static networks.

  Note: The Zigbee 2007 specification includes updates to the Zigbee stack to allow the use of frequency agility and fragmentation on this stack. This stack remains interoperable with the Zigbee 2006 stack and therefore use of these features must be limited to those networks which can handle the complexity of some devices having these capabilities and some devices not.

  • Zigbee堆棧圍繞中央協調器形成,并使用樹尋址來建立網絡。
  • Zigbee PRO堆棧圍繞中央協調器形成,但使用随機尋址方案來避免對樹的限制。始終使用表路由,并提供其他功能,例如:
    • 網絡級多點傳播
    • 多對一和源路由
    • 頻率捷變
    • 不對稱連結處理
    • PAN ID沖突
    • 碎片
    • 标準或高安全性。
  • Silicon Labs不建議在Zigbee堆棧上部署系統,因為Zigbee PRO堆棧具有許多長期網絡穩定性和可靠性所必需的功能。 Zigbee堆棧通常用于小型靜态網絡。
  • 注意:Zigbee 2007規範包括對Zigbee堆棧的更新,以允許在此堆棧上使用頻率捷變和分段。該堆棧仍然可以與Zigbee 2006堆棧互操作,是以這些功能的使用必須限于那些可以處理具有這些功能的某些裝置的複雜性而某些裝置沒有的複雜性的網絡。

2.1 Zigbee裝置對象(ZDO)

  The ZDO (occupying Endpoint 0 of each node) is a stack-level entity defined by the Zigbee Networking Specification for use in network management and information gathering. This section explains how to make use of ZDO functionality in the EmberZNet PRO stack and/or EZSP. An example is described as well.

  The ZDO, an entity in the stack, provides network management capabilities that nodes can use to learn about each other, about the network in general, or for managing certain stack-level functionality. Many features of the ZDO must be implemented as part of a Zigbee Certified Platform (ZCP) and are therefore available on all Zigbee/Zigbee PRO devices, making them useful as an interoperable way to gather and manage system properties on a Zigbee network. The ZDO is implemented through an OTA messaging format known as the Zigbee Device Profile.

  • ZDO(占用每個節點的端點0)是由Zigbee網絡規範定義的用于網絡管理和資訊收集的堆棧級實體。 本節介紹如何在EmberZNet PRO堆棧和/或EZSP中使用ZDO功能。 還描述了一個例子。
  • ZDO是堆棧中的一個實體,它提供網絡管理功能,節點可以使用這些功能來了解彼此,了解一般網絡或管理某些堆棧級功能。 ZDO的許多功能必須作為Zigbee認證平台(ZCP)的一部分實作,是以可在所有Zigbee / Zigbee PRO裝置上使用,這使它們可用作在Zigbee網絡上收集和管理系統屬性的可互操作方式。 ZDO通過稱為Zigbee裝置配置檔案的OTA消息傳遞格式實作。
  The following basic guidelines apply to using the ZDO for network management:
  • Broadcasts requests must go to broadcast mask 0xFFFD.
  • Requests should always be sent to destination endpoint 0, with application profile ID 0x0000, as this indicates that the ZDO (intrinsic in the stack) should handle the message. The source endpoint generally corresponds to the portion of your application that is interested in the requested information.
  • Responses to ZDO requests come from source endpoint 0, to the destination endpoint corresponding to the source used for the Request.
  • If a particular ZDO request handler is not implemented in the stack, a status of EMBER_ZDP_NOT_SUPPORTED (0x84) will be returned in the response.
  • Cluster ID is used to indicate the Request or Response type being sent.
  • Most requests can be sent as unicast, broadcast or multicast, just like any other APS frame (with optional APS acknowledgment), and responses arrive in the IncomingMessageHandler like any other incoming APS message. However, certain kinds of requests, if sent as broadcasts, will not generate a response (in the interest of network bandwidth conservation). There are also certain requests

    that cannot be sent broadcast. For more information on these specific commands, please refer to the Zigbee core specification (document 14-0392).

  • stack/include/zigbee-device-stack.h details the frame formats for commands and responses, including which request types are supported by the EmberZNet PRO stack. Further details about the frame formats are described in the Zigbee Device Profile (ZDP) section of the Zigbee Networking Specification (Zigbee document 14-0392).
  • Utility functions (provided as source code) for generating ZDO requests and parsing certain kinds of responses can be found in app/util/zigbee-framework/zigbee-device-library.h. (There is also an alternative version of this file for EZSP host applications.)
  • All ZDO requests and responses begin with the transaction sequence number as the first byte of the payload. This allows a request to be matched up with a particular response.
  • 以下基本準則适用于使用ZDO進行網絡管理:
    • 廣播請求必須轉到廣播掩碼0xFFFD。
    • 應始終将請求發送到目标端點0,應用程式配置檔案ID為0x0000,因為這表示ZDO(堆棧中的内部)應處理該消息。源端點通常對應于您對所請求資訊感興趣的應用程式部分。
    • 對ZDO請求的響應來自源端點0,到對應于用于請求的源的目标端點。

      如果堆棧中未實作特定的ZDO請求處理程式,則将在響應中傳回狀态EMBER_ZDP_NOT_SUPPORTED(0x84)。

    • 群集ID用于訓示正​​在發送的請求或響應類型。大多數請求可以作為單點傳播,廣播或多點傳播發送,就像任何其他APS幀一樣(具有可選的APS确認),并且響應像任何其他傳入的APS消息一樣到達IncomingMessageHandler。但是,某些類型的請求,如果作為廣播發送,将不會産生響應(為了保護網絡帶寬)。還有一些要求無法發送廣播。有關這些特定指令的更多資訊,請參閱Zigbee核心規範(文檔14-0392)。
    • stack / include / zigbee-device-stack.h

      詳細說明指令和響應的幀格式,包括EmberZNet PRO堆棧支援的請求類型。關于幀格式的進一步細節在Zigbee網絡規範(Zigbee文檔14-0392)的Zigbee裝置配置檔案(ZDP)部分中描述。
    • 可以在

      app/util/zigbee-framework/zigbee-device-library.h

      中找到用于生成ZDO請求和解析某些類型響應的實用程式函數(作為源代碼提供)。 (EZSP主機應用程式還有此檔案的替代版本。)
    • 所有ZDO請求和響應都以事務序列号作為有效負載的第一個位元組開始。這允許請求與特定響應比對。

  As an example, take the case of a Permit Joining ZDO transaction, which facilitates remote control of the PermitAssociation flag for one or more devices in the network.

  For this particular transaction, zigbee-device-stack.h explains the following:

  • 例如,采用Permit Joining ZDO事務的情況,這有助于遠端控制網絡中一個或多個裝置的PermitAssociation标志。
  • 對于此特定事務,zigbee-device-stack.h解釋了以下内容:

1. // Request: [duration:1] [permit:1]

2. // Response: [status:1]

3. #define PERMIT_JOINING_REQUEST 0x0036

4. #define PERMIT_JOINING_RESPONSE 0x8036

  So a Permit Joining request frame would use cluster ID 0x0036, and the response would arrive with cluster ID 0x8036. For the request parameters, the “duration” byte corresponds to the argument you would ordinarily provide to the PermitJoining call in EmberZNet PRO/ EZSP (a number of seconds to allow joining, or 0x00 for always-off joinin , or 0xFF for always-on joining). The “permit authentication” byte used to only be applicable when the recipient of the request was the Trust Center (TC) and controlled whether the TC should perform authentication on “certain devices” during future association requests.

  However, the current Zigbee Networking Specification mandates that the permit authentication byte be 0x01, so this argument in the Permit Joining Request is no longer significant.

  Permit Join Requests are typically sent as a broadcast to all routers, allowing devices to join at any router in the network after this broadcast request has been processed.

  • 是以,Permit Joining請求幀将使用Cluster ID 0x0036,響應将以Cluster ID 0x8036到達。 對于請求參數,“duration”位元組對應于您通常在EmberZNet PRO / EZSP中為PermitJoining調用提供的參數(允許加入的秒數,或者對于always-off joinin為0x00,對于always-on為0xFF)。 “permit authentication”位元組僅用于請求的接收者是信任中心(TC)并且控制TC是否應該在将來的關聯請求期間對“某些裝置”執行認證時才适用。
  • 但是,目前的Zigbee網絡規範要求允許認證位元組為0x01,是以許可連接配接請求中的此參數不再重要。
  • 允許加入請求通常作為廣播發送到所有路由器,允許裝置在處理完廣播請求後加入網絡中的任何路由器。
2.1.1 ZDO進階用法
  Additionally, as of EmberZNet release 3.3.2, Silicon Labs has added the ability for the application (host MCU) to be informed about ZDO requests that the stack is handling, and/or informed about those that the stack does not handle (so that it can handle them itself),and also to give the host a chance to handle endpoint requests (instead of handling these automatically) if desired. Please see comments in the hal/ember-configuration.c file (in SoC platforms) or app/util/ezsp/ezsp-enum.h (for NCP platforms) in EmberZNet releases 3.3.2 and later for descriptions of these available options, which are described as EzspConfigId values 0x26-0x28 (in EZSP) or the following configuration defines (in SoC API):
  • 此外,從EmberZNet版本3.3.2開始,Silicon Labs增加了應用程式(主機MCU)的能力,以便了解堆棧正在處理的ZDO請求,和/或告知堆棧無法處理的那些(以便 它可以自己處理它們,并且如果需要,還可以讓主機有機會處理端點請求(而不是自動處理這些請求)。 請參閱EmberZNet版本3.3.2及更高版本中

    hal/ember-configuration.c

    檔案(在SoC平台中)或

    app/util/ezsp/ezsp-enum.h

    (對于NCP平台)中的注釋,以擷取這些可用選項的描述, 它們被描述為EzspConfigId值0x26-0x28(在EZSP中)或以下配置定義(在SoC API中):

    EMBER_APPLICATION_RECEIVES_SUPPORTED_ZDO_REQUESTS

    EMBER_APPLICATION_HANDLES_UNSUPPORTED_ZDO_REQUESTS

    EMBER_APPLICATION_HANDLES_ENDPOINT_ZDO_REQUESTS

    EMBER_APPLICATION_HANDLES_BINDING_ZDO_REQUESTS

2.2 Zigbee Profiles

  Before Zigbee 3.0, application profiles, or simply profiles, sat on top of the basic Zigbee stack. These were developed to specify the OTA messages required for device interoperability. A given application profile could be certified on either the Zigbee or Zigbee PRO stack. Now, Zigbee 3.0 has introduced an all-encompassing application layer specification for defining OTA behavior for all Zigbee applications.

  The following are the application profile groups that existed before Zigbee 3.0:

  • Home Automation (HA) – Devices for typical residential and small commercial installations.
  • Smart Energy (SE) – For utility meter reading and interaction with household devices.
  • Commercial Building Automation (CBA) – Devices for large commercial buildings and networks.
  • Telecom Application (TA) – Wireless applications within the telecom area.
  • Health Care (HC) – Monitoring of personal health in the home or hospital environment.
  • Retail – Monitoring and information delivery in a retail environment.
  • Zigbee Light Link – Wireless control of LED lighting systems.
  • 在Zigbee 3.0之前,應用程式配置檔案或簡單的配置檔案位于基本的Zigbee堆棧之上。這些是為了指定裝置互操作性所需的OTA消息而開發的。給定的應用程式配置檔案可以在Zigbee或Zigbee PRO堆棧上進行認證。現在,Zigbee 3.0引入了一個包羅萬象的應用層規範,用于為所有Zigbee應用程式定義OTA行為。
  • 以下是Zigbee 3.0之前存在的應用程式配置檔案組:
    • 家庭自動化(HA) - 典型住宅和小型商業設施的裝置。
    • 智能能源(SE) - 用于公用儀表讀數和與家用裝置的互動。
    • 商業樓宇自動化(CBA) - 大型商業建築和網絡裝置。
    • 電信應用(TA) - 電信領域内的無線應用。
    • 醫療保健(HC) - 監控家庭或醫院環境中的個人健康。
    • 零售 - 零售環境中的監控和資訊傳遞。
    • Zigbee Light Link - LED照明系統的無線控制。

  The Zigbee Cluster Library (ZCL) forms a generic basis for the Zigbee common application layer. This library defines common elements that are shared such as data types and allows reuse of simple devices such as on/off switch protocols between different profiles.

  Application profiles defined the roles and functions of devices in a Zigbee network. Two types of application profiles were administered by the Alliance:

  • Public Application Profiles, developed by members of the Zigbee Alliance so that devices from different manufacturers can interoperate.
  • Manufacturer-Specific Application Profiles, developed by product developers creating private networks for their own applications where interoperability is not required.

The Zigbee Alliance now recognizes one application layer, described by the Zigbee Base Device Behavior specification, which defines roles and functions of a device in any Zigbee network. These application behaviors interoperate with any other application.

  If you develop a product based upon your own private application layer specification, the Zigbee Alliance requires you to make use of a unique private profile identifier to ensure the product can successfully co-exist with other products. The Zigbee Alliance issues these unique private profile IDs to member companies upon request and at no charge.

  An application can also be developed using the common Zigbee 3.0 application layer with private extensions for specific features from a manufacturer.

  • Zigbee叢集庫(ZCL)構成了Zigbee通用應用程式層的通用基礎。該庫定義了共享的公共元素,例如資料類型,并允許重用簡單裝置,例如不同配置檔案之間的開/關切換協定。
  • 應用程式配置檔案定義了Zigbee網絡中裝置的角色和功能。聯盟管理兩種類型的應用程式配置檔案:
    • 公共應用程式配置檔案,由Zigbee聯盟成員開發,以便來自不同制造商的裝置可以互操作。
    • 特定于制造商的應用程式配置檔案,由産品開發人員開發,為不需要互操作性的應用程式建立專用網絡。
  • Zigbee聯盟現在識别一個應用層,由Zigbee基本裝置行為規範描述,該規範定義了裝置在任何Zigbee網絡中的角色和功能。這些應用程式行為可與任何其他應用程式互操
  • 如果您根據自己的私有應用層規範開發産品,Zigbee聯盟要求您使用唯一的私有配置檔案辨別符,以確定産品可以與其他産品成功共存。 Zigbee Alliance可根據要求向會員公司免費發放這些獨特的私人檔案ID。
  • 還可以使用常見的Zigbee 3.0應用程式層開發應用程式,該應用程式層具有來自制造商的特定功能的私有擴充。

2.3 Zigbee尋址方案

  The Zigbee PRO stack uses a stochastic address assignment mechanism. Under this mechanism the coordinator is still used to start the network. Each device (routers and end devices) that joins the network is given a randomly assigned address from the device it is joining. The device conducts conflict detection on this address using network level messages to ensure the address is unique. This address is then retained by a device, even if the parent address changes. A best practice is to let the stack assign the addresses.

  Under Zigbee PRO, provisions are intended for a commissioning tool for setup and configuration of networks. This commissioning tool can be used to assign addresses manually. Silicon Labs does not provide a commissioning tool. If you are interested in such a tool, refer to the ZCL Commissioning cluster for information.

  • Zigbee PRO堆棧使用随機位址配置設定機制。 在這種機制下,協調器仍然用于啟動網絡。 連接配接網絡的每個裝置(路由器和終端裝置)都會從其加入的裝置中獲得一個随機配置設定的位址。 裝置使用網絡級消息對此位址進行沖突檢測,以確定位址是唯一的。 即使父位址發生更改,裝置也會保留此位址。 最佳做法是讓協定棧配置設定位址。
  • 在Zigbee PRO下,規定用于設定和配置網絡的調試工具。 該調試工具可用于手動配置設定位址。 Silicon Labs不提供調試工具。 如果您對此類工具感興趣,請參閱ZCL調試群集以擷取資訊。

2.4 Extended PAN IDs

  Developers who have used stack software earlier than Zigbee 2007 should note a new and important change to PAN IDs. Zigbee has added an 8 byte extended PAN ID (EPID or XPID) to facilitate provisioning and PAN ID conflict detection. The extended PAN ID is now included in the beacon payload, following the existing 3 bytes.

  The Extended PAN ID was a network parameter in Zigbee 2007 (EmberZNet 3.x and later) was used in the Zigbee and Zigbee PRO feature sets. This extended PAN ID [EPID] can be thought of as an extension of the basic, 16-bit PAN ID [PID]. The EPID is a 64-bit value set for the entire network by the Zigbee Coordinator [ZC] at the time the personal area network [PAN] is formed and must not change while the PAN is operating (unlike the PID). Like the PID, all nodes within the same PAN share an EPID.

  Other than the scanning and joining processes, the EPID rarely appears in transmitted Zigbee packets due to its large overhead (8 bytes) in the header. However, the EPID is used during a Network Update transaction, where a Network Manager node informs the other devices in the PAN about a PID conflict or channel change, so that nodes moving to a new channel and/or PID can rely on the consistency of the EPID as a criteria for finding the moved network.

  Note that the Extended PAN ID (even if it’s zero) is saved to the non-volatile memory (as part of the tokens) once the node associates into the network, so it won’t change over the lifetime of the device until the device leaves the network.

  • 早于Zigbee 2007使用堆棧軟體的開發人員應該注意對PAN ID的一個新的重要更改。 Zigbee添加了一個8位元組的擴充PAN ID(EPID或XPID),以便于配置和PAN ID沖突檢測。擴充的PAN ID現在包含在信标有效載荷中,跟随現有的3個位元組。
  • 擴充PAN ID是Zigbee 2007中的網絡參數(EmberZNet 3.x及更高版本)用于Zigbee和Zigbee PRO功能集。該擴充的PAN ID [EPID]可以被認為是基本的16位PAN ID [PID]的擴充。 EPID是在個人區域網絡[PAN]形成時由Zigbee協調器[ZC]為整個網絡設定的64位值,并且在PAN運作時不得更改(與PID不同)。與PID一樣,同一PAN内的所有節點共享一個EPID。
  • 除了掃描和連接配接過程之外,由于标頭中的開銷很大(8位元組),EPID很少出現在傳輸的Zigbee資料包中。但是,在網絡更新事務期間使用EPID,其中網絡管理器節點通知PAN中的其他裝置關于PID沖突或信道改變,以便移動到新信道和/或PID的節點可以依賴于EPID作為查找移動網絡的标準。
  • 請注意,一旦節點關聯到網絡中,擴充PAN ID(即使它為零)将儲存到非易失性存儲器(作為令牌的一部分),是以在裝置的生命周期内它不會更改離開了網絡。
2.4.1 Use in Scanning / Forming / Joining Process

  The EPID will appear (along with other information such as the PID) in the beacon results seen by an Active Scan, and when a join is initiated, if the EPID is non-zero in the join request, the EPID will take precedence as the primary criteria for matching up the joiner to the joinee (16-bit PAN ID is effectively ignored). However, it’s possible that some networks (particularly older ones) may not want (or be able) to deal with EPIDs, so the EPID would be zero in the network parameters from the beacon. If the requested EPID is all zeroes during the JoinNetwork operation, only the 16-bit PAN ID will be used to match to a network for the purposes of association.

  While Silicon Labs provides some sample utilities for scanning networks and parsing the results to make a determination about which one to join, this process will generally vary depending on the application design and the level of strictness desired in selecting a network. (For example, the joining device may simply want any available Zigbee PRO network; it may seek a closed network designed specifically for the application in use but may not care which closed network it chooses; or it may seek one specific closed network with specific properties, in the way that I want my laptop at home to join not just any home WiFi network, but my WiFi network in my home.)

  The following guidelines apply to EmberZNet in determining the expected behavior of a Form/Join action given a particular EPID:

  • If an all-zero value is specified for extended PAN ID during FormNetwork, the stack will generate a random 64-bit value for this field.
  • If an all-zero value is specified for extended PAN ID during JoinNetwork, the stack will use the 16-bit PAN ID specified in the JoinNetwork parameters as the primary criteria for selecting a network during the join process.
  • If a non-zero value is specified for extended PAN ID during JoinNetwork, the stack will use the 64-bit extended PAN ID specified in the JoinNetwork parameters (even if 16-bit PAN ID is different) as the primary criteria for selecting a network during the join process.
  • EPID将在主動掃描看到的信标結果中出現(連同其他資訊,如PID),并且當啟動加入時,如果加入請求中的EPID不為零,則EPID将優先為将joiner與joinee比對的主要标準(16位PAN ID實際上被忽略)。然而,某些網絡(特别是較舊的網絡)可能不希望(或能夠)處理EPID,是以EPID在來自信标的網絡參數中将為零。如果在JoinNetwork操作期間請求的EPID全為零,則隻有16位PAN ID将用于比對網絡以進行關聯。
  • 雖然Silicon Labs為掃描網絡提供了一些示例實用程式并解析結果以确定要加入哪一個,但此過程通常會根據應用程式設計和選擇網絡所需的嚴格程度而有所不同。 (例如,加入裝置可能隻是想要任何可用的Zigbee PRO網絡;它可能尋求專門為使用中的應用而設計的封閉網絡,但可能不關心它選擇哪個封閉網絡;或者它可能尋求具有特定屬性的特定封閉網絡,就像我希望家裡的筆記本電腦不僅可以加入任何家庭WiFi網絡,而是加入我家中的WiFi網絡。)
  • 以下指南适用于EmberZNet在确定給定特定EPID的表單/加入操作的預期行為時:
    • 如果在FormNetwork期間為擴充PAN ID指定了全零值,則堆棧将為此字段生成随機64位值。
    • 如果在JoinNetwork期間為擴充PAN ID指定了全零值,則堆棧将使用JoinNetwork參數中指定的16位PAN ID作為在連接配接過程中選擇網絡的主要标準。
    • 如果在JoinNetwork期間為擴充PAN ID指定了非零值,則堆棧将使用JoinNetwork參數中指定的64位擴充PAN -ID(即使16位PAN ID不同)作為選擇網絡的主要标準在加入過程中。

2.4.2 Choosing an EPID

  While the PAN ID is meant to be a randomly chosen, 16-bit value, unique to each network, the EPID is often used more like the SSID field of WiFi networks to give them a user-friendly designation (which is often not so random and is either set by the manufacturer or the installer). However, Silicon Labs discourages using a fixed EPID for all deployments because (unlike the conflicts of the PAN ID) EPID conflicts cannot be resolved if they occur at runtime (because no other unique information exists to distinguish the PANs). Customers wishing to use non-random EPIDs should, at minimum, scan the network (either at the coordinator or through some external commissioning tool) and check that the new PAN’s preferred EPID is not already in use by some other PAN. One approach is to use a small set of preferred EPIDs when forming PANs so that the coordinator can have alternatives if the first choice is in conflict.

  OEMs creating consumer-grade products requiring customer installation (rather than by trained installers) should take particular care to ensure variety of EPIDs, as two customers living next door to each other may purchase the same product for their homes and would prefer to isolate their networks from each other. If those two neighboring homes were to each use PANs with the same EPID, network difficulties would likely arise for both users because the both homes would be considered as one network, and many network address conflicts could occur.

  • 雖然PAN ID是一個随機選擇的16位值,對于每個網絡都是唯一的,但EPID通常更像是WiFi網絡的SSID字段,以便為使用者提供友好的指定(通常不是那麼随意)并由制造商或安裝人員設定)。但是,Silicon Labs不鼓勵對所有部署使用固定的EPID,因為(與PAN ID的沖突不同)EPID沖突如果在運作時發生則無法解決(因為不存在區分PAN的其他唯一資訊)。希望使用非随機EPID的客戶至少應該掃描網絡(在協調器或通過一些外部調試工具),并檢查新PAN的首選EPID是否已被其他PAN使用。一種方法是在形成PAN時使用一小組優選的EPID,以便如果第一選擇發生沖突,協調器可以有替代方案。
  • 建立需要客戶安裝的消費級産品的OEM(而不是經過教育訓練的安裝人員)應特别注意確定各種EPID,因為住在彼此隔壁的兩個客戶可能會為他們的家庭購買相同的産品,并且更願意隔離他們的網絡彼此。如果這兩個相鄰的家庭都使用具有相同EPID的PAN,則兩個使用者可能會出現網絡困難,因為這兩個家庭将被視為一個網絡,并且可能發生許多網絡位址沖突。
2.4.3 EPID與PID對比
  Here is a quick overview of differences between the Extended PAN ID and the standard PAN ID:
  • EPID is 64 bits; PID is 16 bits.
  • EPID is usually used as stack’s criteria for matching to the requested network; PID is only used for matching criteria when EPID is all 0x00 bytes.
  • EPID is only present in a few kinds of packets (beacons, Network Update messages); PID is present in almost all 802.15.4 frames

    (except MAC ACKs).

  • EPID is used as criteria for uniquely identifying the network and for resolving conflicts of PID; PID is used for MAC destination filtering at the radio receiver.
  • EPID may help provide some indication of the network’s identity in the scan results; PID should always be completely random, so it is not as useful in determining which PAN is the “right one”.
  • EPID can be any value in range of 0x0000000000000001 to 0xFFFFFFFFFFFFFFFE (all 0’s and all F’s are reserved values); PID can be any value in the range of 0x0000 - 0xFFFE (all F’s constitute reserved value).
  • 以下是擴充PAN ID與标準PAN ID之間差異的快速概述:
    • EPID是64位; PID是16位。
    • EPID通常用作比對所請求網絡的堆棧标準; 當EPID全為0x00位元組時,PID僅用于比對條件。
    • EPID僅存在于幾種資料包(信标,網絡更新消息)中; PID幾乎存在于所有802.15.4幀中

      (MAC ACK除外)。

    • EPID用作唯一識别網絡和解決PID沖突的标準; PID用于無線電接收器處的MAC目的地過濾。
    • EPID可以幫助在掃描結果中提供網絡身份的一些訓示; PID應始終是完全随機的,是以在确定哪個PAN是“正确的”時不那麼有用。
    • EPID可以是0x0000000000000001到0xFFFFFFFFFFFFFFFE範圍内的任何值(所有0和所有F都是保留值); PID可以是0x0000 - 0xFFFE範圍内的任何值(所有F構成保留值)。

繼續閱讀