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.

CC2538: Had a relate ponit about nwk frame counter.ZED rejoin issue,ZC had no rejoin response.

Part Number: CC2538

Hi TI team 

my previous post had modify the NWK_FRAMECOUNTER_CHANGES_RESTORE_DELTA 250 to 3000 on the ZED(CC2652),but no modify on the ZC.

it seem that solve the ZED rejoin issue.

But I had found  this post, I should modify it according to post. and should modify NWK_FRAMECOUNTER_CHANGES_RESTORE_DELTA 250 to 3000 on the ZC? 

Thanks!

  • Hi,

    It depends.

    In both cases, the issue is on the device which resets before a pending NWK frame counter update occurs in NV.

    Usually, the change to NWK_FRAMECOUNTER_CHANGES_RESTORE_DELTA is not necessary (as you can see from our out-of-box example projects). This is assuming that NWK frame counters are updated when needed.

    In the case of your ZED, it's likely that some application-specific condition/event causes the NWK frame counter to not be updated when it should be (every MAX_NWK_FRAMECOUNTER_CHANGES). If your ZC has a similar configuration/application as the ZED, then it's possible that a reset to the ZC could cause the ZC to use wrong (outdated) NWK frame counter, resulting in communication issues. In that case, it should be ok to increase NWK_FRAMECOUNTER_CHANGES_RESTORE_DELTA on the ZC.

    Regards,
    Toby

  • Hi Toby 

    yes,the ZED(CC2652) power cycle had appeared this nwk frame counter result in the ZC(CC2538) had no rejoin response.

    in turn the ZC(CC2538) power cycle,it had no this rejoin issue.

    What the ZED some application-specific condition/event causes the NWK frame counter,for example.

    I will try to analyze it.

    Thanks!

  • Ok, it seems that ZC does not need to change MAX_NWK_FRAMECOUNTER_CHANGES since there are no issues after you reset the ZC.

  • Hi Toby

    So on the end on this post modify on the zstack3.0.2 on the source code as follows?

    My ZC[CC2538] use zstack3.0.2 should modify it[red line]?

    void ZDApp_RestoreNwkSecMaterial(void)
    {
      uint8 Found = FALSE;
      uint8 i;
      nwkSecMaterialDesc_t nwkSecMaterialDesc;
      uint8 UpdateFrameCounter = FALSE;
    
      //Search if we do have security material for this network
      for( i = 0; i < gMAX_NWK_SEC_MATERIAL_TABLE_ENTRIES; i++)
      {
        osal_nv_read(ZCD_NV_NWK_SEC_MATERIAL_TABLE_START + i,0,sizeof(nwkSecMaterialDesc_t),&nwkSecMaterialDesc);
        {
          if(osal_memcmp(_NIB.extendedPANID,nwkSecMaterialDesc.extendedPanID,Z_EXTADDR_LEN))
          {
            UpdateFrameCounter = TRUE;
            Found = TRUE;
            break;
          }
        }
      }    
      //Check if we do have frame counter stored in the generic
      if(!Found)
      {
        //The last entry readed has the Generic item, thefore, no need to read it again
        if(nwkSecMaterialDesc.FrameCounter)
        {
          UpdateFrameCounter = TRUE;
          i--;                                                 <<<<<<--------- added this
        }
      }  
    
      if(UpdateFrameCounter && (!FrameCounterUpdated))
      {
        FrameCounterUpdated = TRUE;
        
        // Increment the frame counter stored in NV
        nwkSecMaterialDesc.FrameCounter += ( MAX_NWK_FRAMECOUNTER_CHANGES +
                                  NWK_FRAMECOUNTER_CHANGES_RESTORE_DELTA );
        
        nwkFrameCounter = nwkSecMaterialDesc.FrameCounter;
        
        osal_nv_write(ZCD_NV_NWK_SEC_MATERIAL_TABLE_START + i,0,sizeof(nwkSecMaterialDesc_t),&nwkSecMaterialDesc);
        
        nwkFrameCounterChanges = 0;
      }
      return;
    }

     

    Thanks!

  • Yes.

    In that post, the issue happens if the device resets before the first MAX_NWK_FRAMECOUNTER_CHANGES. After the first write, they did not see the issue.

  • Hi Toby

    So on the ZC should modify the source code bug?

    And had not modify expand the parameter MAX_NWK_FRAMECOUNTER_CHANGES[ because the ZC power cycle had no nwk frame counter issue]

    Thanks!

  • Yes.
    And as always, please verify that the applications work as expected after any changes.