CC2652R: zstackmsg_CmdIDs_ZDO_LEAVE_IND is not triggering at router

Part Number: CC2652R

Dear All,

In my project I am using cc2652r for coordinator and router. at router side i want to implement a logic that when coordinator initiate leave request with rejoin is false to kick out the router from network, the router should blocklist that coordinator using its  EPAN and router shoud not join that coordinator again untill router get factory reset. 

 

i am using the zr_zenericapp example is used at router and zc_switch is used at coordinator. no callback is triggring at router.  

so where should I call the blacklist logic to perform this. 

please help me on this to resolve this issue.

Regards,

Sushmitha

 

 

 

  • Hi Sushmitha,

    First you will set has_leaveIndCB and leaveIndCB to true in SetupZStackCallbacks, then you will add logic to the zstackmsg_CmdIDs_ZDO_LEAVE_IND case (make sure to put breaks in before and after).  From there you can see the Zigbee Security Features SLA, Part 2 Task 2, for implementing a deny list on the Router.  You can save EPIDs inside of application non-volatile memory which is retained until erased during a factory reset.

    Regards,
    Ryan

  • Hi Ryan,

    has you mentioned I did  that but still not triggering, attached code below for your reference. Please check.

    static void SetupZStackCallbacks(void)
    {
        zstack_devZDOCBReq_t zdoCBReq = {0};

        // Register for Callbacks, turn on:
        //  Device State Change,
        //  ZDO Match Descriptor Response,
       bool has_mgmtLeaveRsp;
        /** Set to true to receive ZDO Management Leave Response */
        bool mgmtLeaveRsp;
    //     zdoCBReq.has_devStateChange = true;
    // zdoCBReq.devStateChange = true;

       zdoCBReq.has_devStateChange = true;
        zdoCBReq.devStateChange = true;
        zdoCBReq.has_matchDescRsp = true;
        zdoCBReq.matchDescRsp = true;
        zdoCBReq.has_ieeeAddrRsp = true;
        zdoCBReq.ieeeAddrRsp = true;
        zdoCBReq.has_mgmtLeaveRsp = true;
        zdoCBReq.mgmtLeaveRsp = true;
        zdoCBReq.has_leaveIndCB = true;
        zdoCBReq.leaveIndCB = true;
        zdoCBReq.has_deviceAnnounce = true;//CUSTOM DEFINED TO HANDLE THE DEVICE ANNOUNCE CASE BY UER DEFINED
        zdoCBReq.deviceAnnounce = true;//CUSTOM DEFINED TO HANDLE THE DEVICE ANNOUNCE CASE BY UESER DEFINED

        (void)Zstackapi_DevZDOCBReq(appServiceTaskId, &zdoCBReq);
    }
            case zstackmsg_CmdIDs_ZDO_LEAVE_IND:
            {

                  zstack_zdoLeaveInd_t *pInd =
            (zstack_zdoLeaveInd_t *)pMsg->pReq;


            UART2_write(gUartHandle,
                (uint8_t*)"LEAVE CALL BACK TRIGGRED\r\n",
                50,
                NULL);
            }
            break;
    Regards,
    Sushmitha,
  • I apologize for the confusion Sushmitha, zstackmsg_CmdIDs_ZDO_LEAVE_IND is for an indication that other devices have left the network.  zstackmsg_CmdIDs_ZDO_LEAVE_CNF is what you will want to use for the local device leaving the current Zigbee network, which is enabled with has_leaveCnfCB and leaveCnfCB.  I've confirmed this behavior from my end and this is what you'll want to implement to realize your application.  Just be warned that you will want to change the ZDO_LeaveCnf functionality as ZDApp_LeaveReset->ZDApp_ResetTimerStart will force a device reset within LEAVE_RESET_DELAY, so you may want to change this behavior.

    Regards,
    Ryan

  • I checked with above callback but no responce.

    static void SetupZStackCallbacks(void)
    {
        zstack_devZDOCBReq_t zdoCBReq = {0};

        // Register for Callbacks, turn on:
        //  Device State Change,
        //  ZDO Match Descriptor Response,
       bool has_mgmtLeaveRsp;
        /** Set to true to receive ZDO Management Leave Response */
        bool mgmtLeaveRsp;
    //     zdoCBReq.has_devStateChange = true;
    // zdoCBReq.devStateChange = true;

       zdoCBReq.has_devStateChange = true;
        zdoCBReq.devStateChange = true;
        zdoCBReq.has_matchDescRsp = true;
        zdoCBReq.matchDescRsp = true;
        zdoCBReq.has_ieeeAddrRsp = true;
        zdoCBReq.ieeeAddrRsp = true;
        zdoCBReq.has_mgmtLeaveRsp = true;
        zdoCBReq.mgmtLeaveRsp = true;
        // zdoCBReq.has_leaveIndCB = true;
        // zdoCBReq.leaveIndCB = true;
        zdoCBReq.has_leaveCnfCB =true;
        /** Set to true to receive Leave Confirmation */
        zdoCBReq.leaveCnfCB = true;
        zdoCBReq.has_deviceAnnounce = true;//CUSTOM DEFINED TO HANDLE THE DEVICE ANNOUNCE CASE BY UER DEFINED
        zdoCBReq.deviceAnnounce = true;//CUSTOM DEFINED TO HANDLE THE DEVICE ANNOUNCE CASE BY UESER DEFINED

        (void)Zstackapi_DevZDOCBReq(appServiceTaskId, &zdoCBReq);
    }
     
            case zstackmsg_CmdIDs_ZDO_LEAVE_CNF:
              {

                  zstack_zdoLeaveCnf_t *pInd =
            (zstack_zdoLeaveCnf_t *)pMsg->pReq;


            UART2_write(gUartHandle,
                (uint8_t*)"LEAVE CALL BACK TRIGGRED\r\n",
                50,
                NULL);
            }
            break;
            case zstackmsg_CmdIDs_ZDO_LEAVE_IND:
    Please check and let me know.
    Regards,
    Sushmitha
  • Hi Sushmitha,

    You could put a breakpoint inside of ZDO_LeaveCnf to determine whether it is ever entered, and use a sniffer device to check the over-the-air packets. I don't know how to be of further assistance in this regard since I've successfully tested from my end.  What SDK version are you using? Barring ability to use the Leave Ind/Cnf, you could use zstackmsg_CmdIDs_DEV_STATE_CHANGE_IND to check the zstack_DevState which should have changed from zstack_DevState_DEV_ROUTER since it is no longer joined to a network.

    Regards,
    Ryan

  • Hi Ryan,

    SDK version is simplelink_cc13xx_cc26xx_sdk_8_31_00_11

    I tried the debug with break point but no progress.

    Regards,

    Sushmitha

  • Hi Sushmitha,

    If ZDO_LeaveCnf or ZDO_LeaveInd are never entered, and zstack_DevState is still zstack_DevState_DEV_ROUTER (from sendDevStateChangeInd) then it would seem like the ZC is never sending the ZR a leave command.  You should be able to confirm this by sniffing the over-the-air network packets.

    Regards,
    Ryan

  • Hi Ryan,

    ZDO_LeaveCnf or ZDO_LeaveInd are never entered, but router is leaving the network and resetting that I have verified. 

    Regards,

    Sushmitha 

  • router is leaving the network and resetting that I have verified

    How are you confirming this?  You can put breakpoints inside of ZDApp_ResetTimerStart -> SysCtrlSystemReset and use the call stack to determine where exactly the device is being asked to Leave which triggers the device reset.

    Regards,
    Ryan