This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zigbee Task halts on Leave Request

Hi,

We have been working with an end device based on nRF52840 with nRF5_SDK_for_Thread_and_Zigbee_v4.0.0_dc7186b and FreeRtos

This device has some bindings already set to the coordinator.

When it receives a Leave Request from coordinator, the Zigbee Stack gets stucked on zb_address_reset() function. Because of that, the Zigbee task remains blocked for the rest of the time.

Which should be the reason to halt at this point and how this could be avoided?

Regards,

Santiago

  • Hi Santiago,

    I have forwarded your problem and will get back to you as soon as I get a response.

    In the meantime, what does it look like in your signal handler when the leave signal is received?

    Best regards,

    Marte

  • Hi Marte,

    There is no signal triggered. It just halts

  • Hi Santiago,

    What does your code look like? After ZB_ZDO_SIGNAL_LEAVE is called.

    Best regards,

    Marte

  • ZB_ZDO_SIGNAL_LEAVE is never called. In fact, the description of this signal says that is called when the device leaves the network by sending leave command. 

    Find code below:

    case ZB_ZDO_SIGNAL_LEAVE:
            /* This signal is generated when the device itself has left the network by sending leave command.
              *
              * Note: this signal will be generated if the device tries to join legacy Zigbee network and the TCLK
              *       exchange cannot be completed. In such situation, the ZB_BDB_NETWORK_STEERING signal will be generated
              *       afterwards, so this case may be left unimplemented.
              */
            if (status == RET_OK)
            {
              zb_zdo_signal_leave_params_t * p_leave_params = ZB_ZDO_SIGNAL_GET_PARAMS(p_sg_p, zb_zdo_signal_leave_params_t);
              ZIGBEE_LOG_INFO("Network left (leave type: %d)", p_leave_params->leave_type);
    
              if(ZIGBEE_STATE_JOINING != zigbee.state)
              {
                App_Zigbee_Status(ZIGBEE_STATUS_DISCONNECTED);
                Zigbee_Fsm(ZIGBEE_STATE_DISCONNECTED);
              }
            }
            else
            {
              ZIGBEE_LOG_ERROR("Unable to leave network (status: %d)", status);
            }
     
    
          break;

  • H Santiago,

    The end device sends a leave command in your sniffer log, so it does leave, and therefore ZB_ZDO_SIGNAL_LEAVE is called. This signal is generated when the device itself has left the network by sending leave command. ZB_ZDO_SIGNAL_LEAVE is called even if the leave request is from the coordinator. You can test this yourself by using the CLI Agent example and issuing the 'zdo mgmt_leave' command, and you will see that "Network left" is printed.

    Can you please debug your code using breakpoints so that you can see what's happening in your program? You can put the breakpoints at the if statements in the code above, as well as at App_Zigbee_Status() and Zigbee_Fsm().

    What is zigbee.state, and what does the functions App_Zigbee_Status() and Zigbee_Fsm() do? 

    Best regards,

    Marte

Related