Reset zigbee on ZED upon leaving network or reboot

Hello, I'm currently building a zigbee end device using the Zigbee Template example on the nRF5340DK but I am having issues regarding rejoins. My Zigbee Coordinator(ZC) is a 3rd party legacy Zigbee device that doesn't seem to support rejoin requests. Every rejoin request sent from the ZED is denied with "PAN Full" from the ZC. The "PAN Full" is not accurate since I'm only using one ZED (the nrf5340dk). I am using the Zigbee Template from the Zigbee R23 Add-on also for context.

As a result, I'd like to just completely restart Zigbee on the ZED whenever it is rebooted or leaves the network. Then join the ZC network again like it's the devices first time joining. This seems like something that should be supported but I haven't quite figured it out yet. Below are some the methods I've tried:

  • Call zb_set_nvram_erase_at_start( ZB_TRUE)
    • This seems like it should at least fix the scenario where the ZED sends rejoin requests after reboot. However, when I add this, I still see the ZED sending rejoin requests from it's short address
  • Call zb_bdb_reset_via_local_action after leaving network
    • This appears to reset the entire device. My ZED is doing other tasks in addition to Zigbee, so I don't want to completely reset it.
  • Disable ZIGBEE_TC_REJOIN_ENABLED w/ Kconfig
    • I haven't seen a noticeable effect from this except that is leads to a build error in zb_nrf_platform.c on the following line since ZIGBEE_TC_REJOIN_ENABLED is no longer defined:
      • zb_secur_set_tc_rejoin_enabled((zb_bool_t)CONFIG_ZIGBEE_TC_REJOIN_ENABLED);

Please let me know if I'm on the right track with any of these methods, or if there is a separate way to achieve my desired behavior. Thanks

 

Edit: Upon looking at some more documentation of zb_bdb_reset_via_local_action() it seems like this is what I am looking for. However, when I add a zb_bdb_reset_via_local_action(0U) to the code, I see "E: ZBOSS fatal error occurred" printed to the console and the device repeatedly reboots. Is there any more information on where I should add this call for it to work correctly?

Parents
  • Hello,

    I will just address what you added in the edit for now. Please let me know if I should address the above points as well. 

    The "E: ZBOSS fatal error occurred" is from zb_osif_abort() which has the default behavior to reset on asserts. This behaviour can be changed by setting CONFIG_ZBOSS_HALT_ON_ASSERT=y. To get some more information on what is happending before the assert, you can build the sample with CONFIG_LOG_MODE_DEFERRED=y and by increasing the log level for i.e. OSIF with CONFIG_OSIF_LOG_LEVEL_DBG=y. You could also build the sample with debug optimizations and run a debug session. More on debugging in nRF Connect SDK (which also applies to the Zigbee Add-on) is found in i.e. Lesson 2 from the nRF Connect SDK Intermediate course

    From the current information you have shared, it is not clear when you call zb_bdb_reset_via_local_action(0U). Any time after zboss_start() has been called should be accepted, so please verify that you call it at a proper time. 

    Best regards,

    Maria

  • Thank you for the quick response! I previously was calling zb_bdb_reset_via_local_action(0U) in case ZB_ZDO_SIGNAL_SKIP_STARTUP, which I'm guessing is not a valid spot to call it. Since the Zigbee Template example uses zboss_start_no_autostart() instead of zboss_start(), I'm thinking the Zigbee Stack was not fully initialized at this point causing the issue. I moved the call to the following spot. However, I am still seeing the ZED send a Rejoin Request about rebooting or resetting the nRF5340DK. Sometimes the ZED then proceeds to send an Association Request and join as normal. Other times, I never see the the ZED send an Association Request after the rejoin request is denied and Network Rejoin procedure is eventually stopped. Is this an appropriate spot to add zb_bdb_reset_via_local_action(0U) call, or is there a better spot that will provide more consistent behavior?

    	case ZB_BDB_SIGNAL_DEVICE_REBOOT:
    		/* At this point Zigbee stack is ready to operate and the BDB
    		 * initialization procedure has finished. There is network
    		 * configuration stored inside NVRAM, so the device
    		 * will try to rejoin.
    		 *
    		 * Next step: if the device implement Zigbee router or
    		 *            end device, and the initialization has failed,
    		 *            perform network steering for a node on a network,
    		 *            (see BDB specification section 8.2).
    		 */
    		if (status == RET_OK) {
    			zb_ext_pan_id_t extended_pan_id;
    			char ieee_addr_buf[IEEE_ADDR_BUF_SIZE] = { 0 };
    			int addr_len;
    
    			zb_get_extended_pan_id(extended_pan_id);
    			addr_len = ieee_addr_to_str(ieee_addr_buf,
    						    sizeof(ieee_addr_buf),
    						    extended_pan_id);
    			if (addr_len < 0) {
    				strcpy(ieee_addr_buf, "unknown");
    			}
    
    			/* Device has joined the network so stop the network
    			 * rejoin procedure.
    			 */
    			stop_network_rejoin(ZB_FALSE);
    			LOG_INF("Joined network successfully on reboot signal (Extended PAN ID: %s, PAN ID: 0x%04hx)",
    				ieee_addr_buf,
    				ZB_PIBCACHE_PAN_ID());
    		} else {
    			if (role != ZB_NWK_DEVICE_TYPE_COORDINATOR) {
    				LOG_INF("Unable to join the network, start network steering");
    		        zb_bdb_reset_via_local_action(0U); // Correct spot to call reset?
    				start_network_rejoin();
    			} else {
    				LOG_ERR("Failed to initialize Zigbee stack using NVRAM data (status: %d)",
    					status);
    			}
    		}
    		break;

    Edit: Using a zigbee sniffer, I see that in the case where the ZED doesn't ever send an Association Request to my ZC after reset/reboot, it does send Association Requests to other ZCs within range. These requests are denied but I find it odd that the ZED seems to be sending Association Requests to other ZCs except the one I want to it actually join. Any explanation on why this might be the case?

  • Curious if there's any updates that can be provided on this? At this point, I am most interested in disabling the Nordic End Device from ever sending a Rejoin Request message. Is there a way to configure this behavior?

Reply Children
Related