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.

终端节点child aging功能,设备离线后并没有将终端节点数据放入notMyChildList数组中

Other Parts Discussed in Thread: Z-STACK

环境:ZHA1.2.2A

一个ZC设备和一个ZED设备,都启动了child aging功能,zgChildAgingEnable为TRUE,终端节点设置为如果超时4分钟没有发送data request则表示设备掉线

#if !defined ( NWK_END_DEV_TIMEOUT_DEFAULT )
  #define NWK_END_DEV_TIMEOUT_DEFAULT  8    // Default value per ZigBee core specification
#endif

// Value used by END DEVICE when sending End Device Timeout Request
// This is an index into table timeoutValue[] defined in nwk_globals.c
#if !defined ( END_DEV_TIMEOUT_VALUE )
//4 minutes #define END_DEV_TIMEOUT_VALUE 2 // Default value per ZigBee core specification #endif

然后将ZED设备加入到ZC当中,并且在AssociatedDevList关联表中显示ZED设备,timeoutCounter参数随着慢慢递减,然后将ZED断电,当AssociatedDevList中timeoutCounter计数为零时,AssociatedDevList中关于ZED的信息被删除了,此时notMyChildList数组中并没有ZED的信息。这是什么原因?我那里配置不正确吗?

notMyChildList

  • // 10, // 0 10 seconds
    // 2, // 1 2 minutes
    // 4, // 2 4 minutes
    // 8, // 3 8 minutes
    // 16, // 4 16 minutes
    // 32, // 5 32 minutes
    // 64, // 6 64 minutes
    // 128, // 7 128 minutes
    // 256, // 8 256 minutes
    // 512, // 9 512 minutes
    // 1024, // 10 1024 minutes
    // 2048, // 11 2048 minutes
    // 4096, // 12 4096 minutes
    // 8192, // 13 8192 minutes
    // 16384 // 14 16384 minutes

    你的timeoutCounter在debug模式有减一吗,是否有减到0.

  • End Device在入网成功以后,会通过Device Announce把Timeout相关的信息发给父设备。ZDApp_AnnounceNewAddress( void )里的NLME_SendEndDevTimeoutReq。你这个timeout 值正确吗
  • End device timeout request

    end device timeout response

  • [18:50:00.990649]	End Device Timeout Request	61-88-AD-09-1C-00-00-50-30-09-1A-00-00-50-30-01-9B-0D-89-A5-16-00-4B-12-00-38-F6-8E-14-00-4B-12-00-28-01-00-00-00-38-F6-8E-14-00-4B-12-00-00-FE-FF-FF-68-9C-E5-8A-FF-FF
    Frame Information: (56 bytes)
    	Packet ID: 38
    	Protocol: ZigBee
    	Timestamp: 18:50:00.990649
    	Time Delta: 0.002920
    	Channel: 11
    	Length: 56
    	RSSI: -11 dBm
    	Source: USB6408: Texas Instruments CC2531
    	SourceId: USB6408: Texas Instruments CC2531&Texas Instruments CC2531 [USB6408]&0&11
    	Layer: NWK
    	Status: Decrypted
    MAC Header: (9 bytes)
    	Frame Control: 0x8861
    		···· ···· ···· ·001 = Frame Type: [0x1] Data
    		···· ···· ···· 0··· = Security Enabled: [0x0] No
    		···· ···· ···0 ···· = Frame Pending: [0x0] No
    		···· ···· ··1· ···· = Acknowledgement Request: [0x1] Yes
    		···· ···· ·1·· ···· = Intra-PAN: [0x1] Yes
    		···· ··00 0··· ···· = Reserved: 0x0
    		···· 10·· ···· ···· = Destination Addr Mode: [0x2] 16-bit Short Address
    		··00 ···· ···· ···· = Reserved: 0x0
    		10·· ···· ···· ···· = Source Addr Mode: [0x2] 16-bit Short Address
    	Sequence Number: 173
    	Destination PAN ID: 0x1C09
    	Destination Address: 0x0000
    	Source Address: 0x3050
    MAC Payload: (45 bytes)
    	NWK Header: (24 bytes)
    		Frame Control: 0x1A09
    			···· ···· ···· ··01 = Frame Type: [0x1] Command
    			···· ···· ··00 10·· = Protocol Version: [0x2] ZigBee Pro
    			···· ···· 00·· ···· = Route Discovery: [0x0] Suppressed
    			···· ···0 ···· ···· = Multicast Flag: [0x0] Unicast or Broadcast
    			···· ··1· ···· ···· = Security Enabled: [0x1] Yes
    			···· ·0·· ···· ···· = Source Route Included: [0x0] No
    			···· 1··· ···· ···· = Destination IEEE Address Included: [0x1] Yes
    			···1 ···· ···· ···· = Source IEEE Address Included: [0x1] Yes
    			··0· ···· ···· ···· = End Device Initiator: [0x0] No
    			00·· ···· ···· ···· = Reserved: 0x0
    		Destination Address: 0x0000
    		Source Address: 0x3050
    		Radius: 0x01
    		Sequence Number: 155
    		Destination IEEE Address: 00:12:4B:00:16:A5:89:0D
    		Source IEEE Address: 00:12:4B:00:14:8E:F6:38
    	NWK Aux Header: (14 bytes)
    		Network Security Control: 0x28
    			···· ·000 = Network Security Level: [0x0] None
    			···0 1··· = Key NWK ID: [0x1] Network Key
    			··1· ···· = Extended Nonce: [0x1] Yes
    			00·· ···· = Reserved: 0x0
    		NWK Frame Counter: 1
    		Source Address: 00:12:4B:00:14:8E:F6:38
    		NWK Key Sequence Number: 0
    	NWK Payload: 0x00020B
    		NWK Command ID: [0x0B] End Device Timeout Request
    		End Device Timeout Request: 0x0002
    			Request Timeout Enumeration: [0x02] 4 Minutes
    			0000 0000 ···· ···· = End Device Configuration: 0x00
    	NWK MIC: 0x67F989CC
    MAC Footer: 0xFFFF
    	Frame Check Sequence: 0xFFFF
    
    
    [18:50:01.129281]	End Device Timeout Response	61-88-57-09-1C-50-30-00-00-09-1A-50-30-00-00-01-E7-38-F6-8E-14-00-4B-12-00-0D-89-A5-16-00-4B-12-00-28-04-00-00-00-0D-89-A5-16-00-4B-12-00-00-4F-DE-2F-6C-75-56-3A-FF-FF
    Frame Information: (56 bytes)
    	Packet ID: 43
    	Protocol: ZigBee
    	Timestamp: 18:50:01.129281
    	Time Delta: 0.006832
    	Channel: 11
    	Length: 56
    	RSSI: 10 dBm
    	Source: USB6408: Texas Instruments CC2531
    	SourceId: USB6408: Texas Instruments CC2531&Texas Instruments CC2531 [USB6408]&0&11
    	Layer: NWK
    	Status: Decrypted
    MAC Header: (9 bytes)
    	Frame Control: 0x8861
    		···· ···· ···· ·001 = Frame Type: [0x1] Data
    		···· ···· ···· 0··· = Security Enabled: [0x0] No
    		···· ···· ···0 ···· = Frame Pending: [0x0] No
    		···· ···· ··1· ···· = Acknowledgement Request: [0x1] Yes
    		···· ···· ·1·· ···· = Intra-PAN: [0x1] Yes
    		···· ··00 0··· ···· = Reserved: 0x0
    		···· 10·· ···· ···· = Destination Addr Mode: [0x2] 16-bit Short Address
    		··00 ···· ···· ···· = Reserved: 0x0
    		10·· ···· ···· ···· = Source Addr Mode: [0x2] 16-bit Short Address
    	Sequence Number: 87
    	Destination PAN ID: 0x1C09
    	Destination Address: 0x3050
    	Source Address: 0x0000
    MAC Payload: (45 bytes)
    	NWK Header: (24 bytes)
    		Frame Control: 0x1A09
    			···· ···· ···· ··01 = Frame Type: [0x1] Command
    			···· ···· ··00 10·· = Protocol Version: [0x2] ZigBee Pro
    			···· ···· 00·· ···· = Route Discovery: [0x0] Suppressed
    			···· ···0 ···· ···· = Multicast Flag: [0x0] Unicast or Broadcast
    			···· ··1· ···· ···· = Security Enabled: [0x1] Yes
    			···· ·0·· ···· ···· = Source Route Included: [0x0] No
    			···· 1··· ···· ···· = Destination IEEE Address Included: [0x1] Yes
    			···1 ···· ···· ···· = Source IEEE Address Included: [0x1] Yes
    			··0· ···· ···· ···· = End Device Initiator: [0x0] No
    			00·· ···· ···· ···· = Reserved: 0x0
    		Destination Address: 0x3050
    		Source Address: 0x0000
    		Radius: 0x01
    		Sequence Number: 231
    		Destination IEEE Address: 00:12:4B:00:14:8E:F6:38
    		Source IEEE Address: 00:12:4B:00:16:A5:89:0D
    	NWK Aux Header: (14 bytes)
    		Network Security Control: 0x28
    			···· ·000 = Network Security Level: [0x0] None
    			···0 1··· = Key NWK ID: [0x1] Network Key
    			··1· ···· = Extended Nonce: [0x1] Yes
    			00·· ···· = Reserved: 0x0
    		NWK Frame Counter: 4
    		Source Address: 00:12:4B:00:16:A5:89:0D
    		NWK Key Sequence Number: 0
    	NWK Payload: 0x02000C
    		NWK Command ID: [0x0C] End Device Timeout Response
    		End Device Timeout Response: 0x0200
    			Status: [0x00] Success
    			Parent Information: 0x02
    				···· ···0 = MAC Data Poll Keep Alive Supported: [0x0] No
    				···· ··1· = End Device Timeout Request Keepalive Supported: [0x1] Yes
    				···· ·0·· = Power Negotiation Support: [0x0] No
    				0000 0··· = Reserved: 0x0
    	NWK MIC: 0xECC3760D
    MAC Footer: 0xFFFF
    	Frame Check Sequence: 0xFFFF
    
    

  • AssociatedDevList中的timeoutCounter有递减,里面是秒数。
  • 测试后还发现,如果END_DEV_TIMEOUT_VALUE定义为8,终端设备不会发送Orphan Notification消息,通讯正常,如果设置为其他参数,终端设备会发送Orphan Notification消息。

    抓包日志如下:

    childaging.rar

  • 你的设备确实突然发送了Orphan Notification,但是协调器也立即回复了Coord Realignment 也没有影响稳定性。 你对Stack 做过什么修改吗?
    我在使用初始sdk测试没这个问题。
    e2echina.ti.com/.../236687
    上面的帖子对childaging 有比较完善的描述,如果你用初始化测试还有这个问题,最近放假不方便测试,你可以发到英文论坛。
    e2e.ti.com/.../158
  • 使用官网下载的ZHA1.2.2A,未修改过其他,只使能了child aging和NWK_END_DEV_TIMEOUT_DEFAULT=1,END_DEV_TIMEOUT_VALUE=1,然后将sampleSwitch工程的ZC和ZED烧录到两个设备,ZED设备还是有Orphan Notification情况发生。

    原始版本的日志:

    原版childaging.rar

  • 将END_DEV_TIMEOUT_VALUE=8,NWK_END_DEV_TIMEOUT_DEFAULT=8日志如下:

    childaging2.rar

  • ZHA1.2.2A 的child aging並不完整、建議你要用child aging的話就用Z-Stack 3.0.2

  • 碰到一个有趣的现象,当ZC接收到ZED的data request后AssociatedDevList里面的timeoutCounter并没有重置,还在继续递减,只有当ZED设备发送Orphan Notification消息后,ZC中AssociatedDevList里面的timeoutCounter被重置了。
  • 你有用Z-Stack 3.0.2試試嗎?

  • 没有,我们公司产品都是ZHA1.2.2A的。 换3.0.2协议栈的话有风险。
  • ZED设备的data request请求是在哪里处理的?
  • 客户无法获取data request的处理。