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.

why does coordinator will sending the NWK leave MSG when a new device join?

Other Parts Discussed in Thread: Z-STACK

Hi there

    

         there  is a enddevice(ZED), which was already  joined  the network.

         when  i  doing a factory reset, and  make  it rejoin  the  same network  again.

         The coordinator  was sending  a  NWK  leave   msg  to  the ZED, then it cause the ZED  could not  be working  for a while  ,then  out of the normal state .

      

         There are  two  log .       

          Desktop.rar 

           1.  Why  does  the coordinator keep the NWK Leave  MSG  for  ZED  when  it finish doing  factory and   rejoin again?

            2. What would the  ZED do ,when it  receive the NWK Leave  while  it was  just  join the network? 

 

  • Can you specify which Z-Stack version and example you are testing? Do you modify anything in Z-Stack when you test this?
  • Zstack- 1.2.2.42930

    custom code

    i have modify the factory reset as below

    //delete the user item of NV
    osal_nv_delete( ZONE_CIEADDRESS_AND_ENROLL_INFO, NV_CIEADDR_LEN+NV_EXTDATA_LEN);
    //delete NWK HOLD item
    osal_nv_delete( NWKHOLD_STATE, NV_NWKHOLD_LEN );



    // ZDO Management Leave server service
    zAddrType_t *dstAddr_All =NULL;

    dstAddr_All->addrMode = (afAddrMode_t)(AddrBroadcast);
    dstAddr_All->addr.shortAddr = 0xFFFF;

    //leave network without waiting other parents feedback;
    ZDP_MgmtLeaveReq(dstAddr_All, NLME_GetExtAddr(), FALSE,FALSE, 1);

    BroadcastTime =5; //reset after 5s
    HAL_DISABLE_P0_INTERRUPTS();
    zclEmerButton_BroadcastLeave_TimeChange();

    // Put device back to factory default settings
    // Set the NV startup option to force a "new" join. //3
    // bit set both default configuration and default network
    zgWriteStartupOptions( ZG_STARTUP_SET, ZCD_STARTOPT_DEFAULT_NETWORK_STATE | ZCD_STARTOPT_DEFAULT_CONFIG_STATE );


    // Set every field to 0
    // This will enable the device to rejoin the network after reset.
    // Leave the network, and reset afterwards
    NLME_LeaveReq_t leaveReq;
    osal_memset( &leaveReq, 0, sizeof( NLME_LeaveReq_t ) );
    leaveReq.rejoin = TRUE;

    if ( NLME_LeaveReq( &leaveReq ) != ZSuccess )
    {
    // Couldn't send out leave; prepare to reset anyway
    // If ZDApp_LeaveReset( FALSE );
    // the device only suceess in the ZC was always working
    // or the device will set DEV_HOLD after doing the factory reset
    ZDApp_LeaveReset( TRUE );
    }

    osal_stop_timerEx( zclEmerButton_TaskID, FactoryReset_EVT );

    MT_SysCommandProcessing( aProcessCmd );
  • It seems that you are manipulating something and causing this. If you use original Z-Stack without these modifications, do you still see this behavior?
  • manipulating ??


    en ,maybe there is a long delay of my coordinator as there are so many devices in the network~~~~~
    so when ZED send a leave request, the coordinator keep the NWK leave for some time ,

    and i just let ZED rejoin again quickly , then when it joined , it will send a data request , then it receive the NWK Leave

    so it leaves~~~~~
  • I mean what you intend to do by adding those code?