This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Zigbee3.0.2协议栈协调器恢复出厂设置后,原网络依旧会对其产生影响的BUG

Other Parts Discussed in Thread: Z-STACK
1、协议栈:Z-Stack3.0.2
2、处理器:协调器-CC2538、终端设备-CC2530
3、问题描述:
(1)交换TC KEY过程设为FALSE:BDB_DEFAULT_TC_REQUIRE_KEY_EXCHANGE=FALSE。
(2)协调器建网完成后开启允许入网,终端节点顺利入网。
(3)协调器调用“bdb_resetLocalAction()”函数恢复“出厂设置”。
(4)协调器恢复“出厂设置”后再通过BDB_Start函数建立网络但不允许入网。
(5)由于终端节点在“bdb_RegisterCommissioningStatusCB()”BDB状态回调函数中的“BDB_COMMISSIONING_PARENT_LOST”状态中调用“bdb_ZedAttemptRecoverNwk()”函数请求恢复网络。然后就出现了以下抓包的一幕:终端节点还是能向协调器发送“data request”命令,而协调器则会不停的发送“Leave”命令给终端设备,但是终端设备却不退出网络,依旧发送“data request”命令给协调器,而协调器则会一直发送“Leave”命令。
    出现“Leave”命令离网不成功的原因我猜测是因为协调器的“zgPreConfigKeys = FALSE;”而“-DDEFAULT_KEY="{0}"”的缘故。这样协调器每次建网用的“NWK KEY”都是随机的,所以终端无法解析“新”协调器发出的“Leave”命令。于是我把““-DDEFAULT_KEY="{0}"””写成了固定值,固定“NWK KEY”,再进行上述操作。这时候终端会直接“rejoin request”进入“恢复出厂设置”的协调器当中,这样协调器“恢复出厂”设置还有意义吗?
4、请问出现这种情况是协议栈的问题还是我配置的问题?我想实现协调器“恢复出厂设置”后就成为一个新的协调器,以前局域网中的设备对它都无影响,请问这个该怎么实现?我记得我的“Z-Stack 2.5.0”中使用此方法是不会出现上述情况的。
    非常感谢您的解答!
  • 协调器恢复“出厂设置”后再通过BDB_Start函数建立网络,终端节点也要恢复“出厂设置”后再重新入網、不然就是會出現你描述的現象

  • 如果终端设备没有恢复“出厂设置”,那协调器不就会一直发送“Leave”命令给终端,如果原网络有很多终端节点,那不就要给很多个终端节点发送“Leave”命令,这不就造成网络拥堵了吗?
  • 照理說终端设备没有恢复“出厂设置”,那就不應該會加入协调器、除非协调器重新建網用的PANID是一樣的
  • 对,PANID建网时是随机的,我看了抓包两次的PANID也是不一样的,可是终端就是会发送“data request”给协调器,然后协调器发送“Leave”给终端,你可以简单测试一下,会出现这种情况的。可是有一点很奇怪,就是协调器恢复“出厂设置”后,还需要正常加入一个终端节点,然后原终端节点才会从发送“beacon request”请求加回原网络的状态,变成发送“data request”给协调器,协调器就会开始发送“Leave”命令给原终端节点。
  • TI工作人员可以来指导一下吗?
  • 可以把sniffer log貼上來嗎?
  • 请提供一下你使用的例程,和抓包文件
  • 我们会在下面的链接讨论您的问题, 请在下面的链接递交您的sniffer log文件。
    e2e.ti.com/.../754099
  • 抓包工具:SmartRF Packet Sniffer 2

    解析工具:Wireshark

    信道:26

    说明:

    1、在第“18”个包开始开启允许入网180秒,这个没抓到我说明一下。

    2、然后从“19-81”个包为第一个设备(0x2ac8)入网成功过程。

    3、在第“181”个包开始,协调器通过“bdb_resetLocalAction()”函数恢复“出厂设置”。此时第一个终端还是正常的通过“bdb_ZedAttemptRecoverNwk()”函数请求恢复原网络。

    4、第“247-314”个包开始上电第二个终端设备并成功入网。

    5、第“344”个包开始第一个终端节点开始被协调器请求离网。

  • 沒有看到你附上抓包檔
  • 忘了,下个帖子付了
  • 请回复下面的帖子,并附上你的network key。我们会在下面的帖子讨论你的问题。
    e2e.ti.com/.../754099
  • 需要网络密钥吗?
    第一次生成的网络密钥:59:f8:b9:22:b1:b9:f7:d2:87:fd:a3:21:78:78:a2:42
    恢复出厂设置后生成的网络密钥:31:9b:54:eb:7c:6f:22:ac:d8:fd:99:01:6a:80:2e:40
    TC LINK KEY 是默认的:0x5a, 0x69, 0x67, 0x42, 0x65, 0x65, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x30, 0x39
  • packet no.190的時候,ZC已經恢复出厂设置完成新網組建了嗎?還是一直到packet no.247才完成新網組建?
  • packet no.190的時候协调器就已经建立了新网络并且允许入网了
  • packet no.190的時候协调器就已经建立了新网络并且允许入网了
  • 在《Z-Stack 3.0 Developer's Guide》里的"15.3 Parent Lost"有说明父节点丢失时终端节点的情况。只要同“channel”,同“Extened PANID”,同“child device capacity”就能重入网了,我记得“Extened PANID”是不是默认为建网设备的“MAC地址”?

    15.3 Parent Lost
          If an end device loses contact with its parent device or is reset while being on a network, the BDB module will notify the application a status of BDB_COMMISSIONING_PARENT_LOST after which the end device cannot perform any other commissioning method. The device must either restore its network by finding another parent device or reset to factory new and then be commissioned again. To restore the network the device must call bdb_ZedAttemptRecoverNwk, this will cause the device to perform a single active scan in the same channel in which it was part of the network to search for any suitable parent (same Extended PANID and child device capacity). This means that the device will only send a single beacon request and if no suitable parent device is found, another notification BDB_COMMISSIONING_PARENT_LOST is sent to the application. The application is responsible for attempting to restore the network, but it is recommended to have a period in which the attempts have a short interval, then goes to a larger interval, to reduce the power consumption. If Finding and Binding was in progress while the device lost its parent, it will keep running and will resume its operation for the time left after the device restores its operation.

  • 总结帖:

    1、首先我在文章中提出的问题是客观存在的,但是不算是BUG,是协议栈就是这么设定的。

    2、问题的原因跟我在问题描述中猜测的一样,可在《Z-Stack 3.0 Developer's Guide》文档的第“15.3 Parent Lost”中找到。

    15.3 Parent Lost
          If an end device loses contact with its parent device or is reset while being on a network, the BDB module will notify the application a status of BDB_COMMISSIONING_PARENT_LOST after which the end device cannot perform any other commissioning method. The device must either restore its network by finding another parent device or reset to factory new and then be commissioned again. To restore the network the device must call bdb_ZedAttemptRecoverNwk, this will cause the device to perform a single active scan in the same channel in which it was part of the network to search for any suitable parent (same Extended PANID and child device capacity). This means that the device will only send a single beacon request and if no suitable parent device is found, another notification BDB_COMMISSIONING_PARENT_LOST is sent to the application. The application is responsible for attempting to restore the network, but it is recommended to have a period in which the attempts have a short interval, then goes to a larger interval, to reduce the power consumption. If Finding and Binding was in progress while the device lost its parent, it will keep running and will resume its operation for the time left after the device restores its operation.

    在协调器“恢复出厂设置”后,终端设备1失去父节点,然后调用“bdb_ZedAttemptRecoverNwk()”函数尝试恢复网络。之后协调器建立新网络,建立的新网络是同一“channel”,同一“Externed PANID”,不同“PANID”的网络,因为协议栈为了确保每一个“Externed PANID”都是唯一的,所以“Externed PANID”默认等于设备自身的MAC地址,所以两次建网时“Externed PANID”都是相同的。按照“15.3 Parent Lost”章节的描述,终端设备1是可以通过“rejoin”流程进入协调器建立的新网络的。但是我的“-DDEFAULT_KEY="{0}"”的缘故,导致两次建网网络的“NWK Key”是不同的,所以终端节点1无法顺利“rejoin”,而协调器则一直发送“leave”命令给终端设备1。当我把协调器的“-DDEFAULT_KEY”固定时,两次建网后的“NWK KEY”是一样的,终端节点1可顺利的加入新网络。

    3、解决问题的方法:没什么解决方法,协调器单独恢复出厂设置后就是会出现这种情况,当原网络中终端节点很多的话估计还会造成网络堵塞。只能在协调器恢复出厂设置前或后将所有终端节点恢复出厂设置。

    4、请问大家还有什么其它更好的恢复出厂设置方法吗?

    以下附上在国外论坛中讨论该问题的过程:

    e2e.ti.com/.../2792727