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.

CC2652R: controversies of sleepy End Device receives and process ZDO Mgmt-Leave Command.

Part Number: CC2652R
Other Parts Discussed in Thread: Z-STACK

in "zdo_object.c", function "ZDO_ProcessMgmtLeaveReq".

Fullscreen
1
2
3
4
5
6
7
8
9
if ( ZG_BUILD_ENDDEVICE_TYPE )
{
//If rejoin is TRUE, the device will stop polling when processing rejoin.
if(req.rejoin == FALSE)
{
// Stop polling and get ready to reset
nwk_SetCurrentPollRateType(POLL_RATE_DISABLED,TRUE);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The annotation said that "If rejoin is TRUE, the device will stop polling when processing rejoin.". But in this code, the polling is stoped when rejoin flag is "FALSE". The other issue is that end-device receives mgmt-leave-command whose target-extAddr dnon't match with current end-device's, the end device will still stop polling.

So I think this code should be like this

Fullscreen
1
2
3
4
5
6
7
//If rejoin is TRUE, the device will stop polling when processing rejoin.
//Is there any controversial processing about End-Device's Mgmt-Leave command, luoyiming 2020-07-07
if( (req.rejoin == TRUE) && (req.extAddr == NULL) )
{
// Stop polling and get ready to reset
nwk_SetCurrentPollRateType(POLL_RATE_DISABLED,TRUE);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • The way I interpret this functionality, the poll rate should be disabled if the device is not rejoining.  Are you observing errant behavior otherwise?  Also, there is code beforehand which states that only the parent device can request a ZED to leave:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    if ( ( ZG_BUILD_ENDDEVICE_TYPE ) && ( ZG_DEVICE_ENDDEVICE_TYPE ) )
    {
    //Only the parent device can request to leave, otherwise silently discard the frame
    if(inMsg->srcAddr.addr.shortAddr != _NIB.nwkCoordAddress)
    {
    return;
    }
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Therefore the message should already be discarded if not directly intended for this device

    Regards,
    Ryan

  • 1,When parent device send a broadcast mgmt-leave-req, and the ext-Addr of this packet is not math with the end-device, end-device need not leave the network.

    2, "nwk_SetCurrentPollRateType(POLL_RATE_DISABLED,TRUE)"  needs be executed when "req.rejoin" is "TRUE" not "FALSE".

  • 1. When would a parent device need to broadcast a ZDO MGMT Leave Request which does not apply to the child?  The ZED would also have to be a non-sleepy configuration.  This appears to be a very specific corner case.

    2. Why should the poll rate be disabled when rejoin is TRUE?  It should be turned off when not rejoining, otherwise the rejoin process will re-establish the correct poll rate.  I have not observed ZED data requests behaving errantly due to this function.

    Regards,
    Ryan

  • 1,some of zigbee coordinator based on SiliconLabs MCU will send broadcast ZDO MGMT Leave Request, which dstAddr is "0xFFFF" can be received by CC2652R-ZED.  

    2, In the annotation  of this code, it has said "If rejoin is TRUE stop polling". But in the code, polling is stoped when "rejoin" is FALSE.

  • I've let the Software Development Team know.

    Regards,
    Ryan

  • But until now, I have not understood when should the ZED stop polling? Rejoin-TRUE or Rejoin-FALSE? 

  • Logically, there is no need to poll if you have left a network and are not planning to rejoin it.  The default code setting appears to be aligned with other usage of POLL_RATE_DISABLED within Z-Stack (ex. ZDApp_LeaveReset) which is why I have recommended leaving it as being set to TRUE.

    Regards,
    Ryan