参考文档:

ug103-02-fundamentals-zigbee.pdf section4 zigbe routing concepts

docs-05-3474-21-0csg-zigbee-specification.pdf 3.6.3 Routing

Broadcast Routing

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 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.

广播地址:

0xffff

All devices in PAN

0xfffe

Reserved

0xfffd

macRxOnWhenIdle = TRUE

0xfffc

All routers and coordinator

0xfffb

Low power routers only

0xfff8 - 0xfffa

Reserved

Source Address
(2bytes)

Sequence Number
(1byte)

Expiration Time
(1byte)

   

broadcast initiator

 

A countdown timer indicating the number of seconds until this

   

entry expires; the initial value is nwkNetworkBroadcastDeliveryTime.

广播报文主要是通过BTR记录检测邻居节点是否已收到报文,如果邻居节点已收到报文,当前节点不再重发报文;如果未收到,重发nwkMaxBroadcastRetries次。

中间路由节点根据radius距离值,判断是否继续转发。

Multicast Routing

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.

  1. 只有数据帧使用多播,nwk command frame不使用多播。
  2. 多播详细可以由end device发起,多播报文不能发往睡眠类end device

Member Mode:成员类型多播(广播方式)

按照广播的方式,根据BTT广播记录表,广播报文。

节点接收到邻居发送的member mode多播报文,查询BTT记录。如果之前已处理过该报文,丢弃。

查询nwkGroupIDTable表,如果当前节点的groupID与报文的groupID匹配,通知上层处理该报文;

使用广播转发该报文,不需要使用passive ACK,经过nwkPassiveAckTimeout之后,重发报文,共发送nwkMaxBroadcastRetries次。

demo 抓包报文

发送原始报文:

中间节点转发:

Non-Member Mode:非成员类型多播(单播方式

检索路由表,查询groupID对应的下一跳地址,如果找到合法记录,发送(转发)报文。

如果没有记录,根据路由发现规则,建立新路由,单播转发报文。

查询nwkGroupIDTable表,如果当前节点的groupID与报文的groupID匹配,通知上层处理该报文;

直接发送

邻居节点不用查询路由表,报文直接发送。

2. Table Routing

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.

以A希望与D通信为例:

  1. A发送路由请求(广播),B,C节点广播路由请求,并将到A的路由保存到自己的路由表中
  2. D回应RouteReply,C、B根据自己的路由表,将报文转发到A
  3. A通过下一跳B节点,将数据发送到D,

RouteTable 格式:

Destination Address
(2Bytes)

status
(3bit)

No Route cache
(1bit)

Many-to-one
(1bit)

Route record required
(1bit)

GroupID flag
(1bit)

Next-hop address
(2 bytes)

 

0:ACTIVE
1:DISCOVERY_UNDERWAY
2:DISCOVERY_FAILED
3:INACTIVE
4:VALIDATION_UNDERWAY

   

A flag indicating that the destination address is a Group ID.

The 16-bit network address of the next hop on the way to the destination.

The types of routing discussed below are:
• Table Routing
• Broadcast Routing
• Multicast Routing
• Many-to-One/Source Routing

Many-To-One routing/Source routing

协调器发送Many-To-One route request广播报文,各子设备通过此报文获取到协调器的路由(接收到了上一节点转发的Route request)。

子设备有数据发往协调器时,先发送route record报文,协调器通过该报文获取到子设备的路由。

协调器发报文到子设备时,报文可以带上转发路径,路径中的各节点根据路径转发,称为source routing。

这种方式,可节省中间节点的内存,中间节点不需要大量的路由表条目。

High/Low RAM concentrator (协议文档中的memory constrained concentrator)

Nodes communicating with high RAM concentrators will continue to send in the route record packet with every inbound message until they receive their first source-routed packet from the concentrator that uses that recorded route. This source routed packet is what tells the node that the source route worked. The APS acknowledgement, if these are turned on, will count as this source routed packet. Also, this route-record suppression is even true for messages routed through this node. Thus, if outlier A sends to concentrator C via many-to-one route A-B-C, the first source routed message from C to B to A will cause B (and A) to stop sending route records up to the concentrator.

Please note,that if the concentrator is also the trust center, communication with the trust center will always be as if it were a low ram concentrator, so route records will always be sent in this case.

High Ram concentrator: 子设备持续发送route record,直到concentrator通过route record记录的路径发送了报文到子设备。报文包括APS ACK报文。

Low ram concentrarot:子设备每次单播一个报文,都发送route record。增加了网络中的数据量。

实际应用中,MTTO routing模式下,为了让concentrator快速恢复到子设备的路由,可以在发送MTTO route request报文后,触发子设备发送报文到concentrator。并且需要发送route record报文。(我们的实现方式:发送MTTO route request, 设置报文中的标记为Low Ram Concentrator,广播子设备的IEEE地址查询,子设备回应地址查询报文,发送route record, 协调器获取最新的路由路径)

MTTO Low Ram Concentrator:

IEEE Address Request:

普通MTTO:

Zigbee系列(路由机制)的更多相关文章

  1. C#进阶系列——WebApi 路由机制剖析:你准备好了吗?

    前言:从MVC到WebApi,路由机制一直是伴随着这些技术的一个重要组成部分. 它可以很简单:如果你仅仅只需要会用一些简单的路由,如/Home/Index,那么你只需要配置一个默认路由就能简单搞定: ...

  2. C#进阶系列——WebApi 路由机制剖析:你准备好了吗? 转载https://www.cnblogs.com/landeanfen/p/5501490.html

    阅读目录 一.MVC和WebApi路由机制比较 1.MVC里面的路由 2.WebApi里面的路由 二.WebApi路由基础 1.默认路由 2.自定义路由 3.路由原理 三.WebApi路由过程 1.根 ...

  3. 迈向angularjs2系列(6):路由机制

    目录1.angular-seed的路由2.路由机制的探索3.懒加载 一:angular-seed的路由 step1:安装种子项目    $ git clone --depth 1 https://gi ...

  4. 【C#】 WebApi 路由机制剖析

    C#进阶系列——WebApi 路由机制剖析:你准备好了吗? 转自:https://blog.csdn.net/wulex/article/details/71601478 2017年05月11日 10 ...

  5. WebApi 路由机制剖析

    阅读目录 一.MVC和WebApi路由机制比较 1.MVC里面的路由 2.WebApi里面的路由 二.WebApi路由基础 1.默认路由 2.自定义路由 3.路由原理 三.WebApi路由过程 1.根 ...

  6. Linux mips64r2 PCI中断路由机制分析

    Linux mips64r2 PCI中断路由机制分析 本文主要分析mips64r2 PCI设备中断路由原理和irq号分配实现方法,并尝试回答如下问题: PCI设备驱动中断注册(request_irq) ...

  7. 走进AngularJs(八) ng的路由机制

    在谈路由机制前有必要先提一下现在比较流行的单页面应用,就是所谓的single page APP.为了实现无刷新的视图切换,我们通常会用ajax请求从后台取数据,然后套上HTML模板渲染在页面上,然而a ...

  8. MVC5之路由机制

    ---恢复内容开始--- MVC是一种模式,是基于asp.net上的一种设计.路由机制不属于MVC,路由机制属于asp.net.因此,mvc的路由机制就是基于asp.net路由机制上的一种“自定制”. ...

  9. MVC路由机制

      按照传统,在很多Web框架中(如经典的ASP.JSP.PHP.ASP.NET等之类的框架),URL代表的是磁盘上的物理文件.例如,当看到请求http://example.com/albums/li ...

  10. typecho路由机制详解

    本文介绍的是typecho的路由机制,引自 不烦恼路由机制是typecho的核心,有很多功能都是基于路由功能设计的,理解并熟悉TE的路由机制将非常有助于插件的开发. 完整的路由表如下: array ( ...

随机推荐

  1. js实现字符串一个一个依次显示

    <html><head><meta http-equiv="Content-Type" content="text/html; charse ...

  2. Springboot+RestTemplate 简单使用

        spring框架提供的RestTemplate类可用于在应用中调用rest服务,它简化了与http服务的通信方式,统一了RESTful的标准,封装了http链接, 我们只需要传入url及返回值 ...

  3. upper_bound()与lower_bound()的使用

    upper_bound()与lower_bound()的使用 c++中的许多库函数可以使我们的代码量大大减少,也可使问题简单化.很早之前就接触了upper_bound()与lower_bound(), ...

  4. multi_index_container

    转自:https://blog.csdn.net/buptman1/article/details/38657807 multi_index_container: Boost Multi-index ...

  5. Spring 源代码阅读之声明式事务

    事务控制流程 例如对如下代码进行事务控制 class service1{ method1(){ method2(); } } class service2{ method2(); } 原理:建立一个m ...

  6. P2245 星际导航

    题目描述 sideman 做好了回到 Gliese星球的硬件准备,但是 sideman 的导航系统还没有完全设计好.为了方便起见,我们可以认为宇宙是一张有 N 个顶点和 M 条边的带权无向图,顶点表示 ...

  7. R语法:<<-为全局变量赋值

    例:在函数内部为全局变量赋值 all_predata_time <- data.frame(pd=0.1,Row=1,preRow=0,pt=0.1,stasid='1',InitDate='1 ...

  8. 1553: Good subsequence (很奇妙的set模拟题,也可以直接暴力)

    1553: Good subsequence Submit Page    Summary    Time Limit: 2 Sec     Memory Limit: 256 Mb     Subm ...

  9. 02_Docker在CentOS 6和CentOS 7下的安装

    CentOS 7 环境下安装docker 安装Docker 检查系统内核是否高于Linux3.10版本 uname -r 使用root权限操作,确保yum包是最新版本 sudo yum update ...

  10. JavaSE日常笔记汇总

    1. If和switch的比较 2. continue的注意事项 在for循环中,当执行continue语句时,i++还是会执行,continue语句只代表此次循环结束,i还是会累加,并继续执行下次循 ...