Hi Ryan:
Previous mentioned topic:https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/p/767378/2838938?tisearch=e2e-sitesearch&keymatch=TP2_LEGACY_ZC#2838938
As we all known,some customer want to zigbee HA 1.2 devices join in standard zigbee 3.0 network formed by ZC,but the zigbee 1.2 and 3.0 not fully compatibility on ZC side,therefore,customer have to define macro TP2_LEGACY_ZC whenever build ZC project,but this may be caused a typical behaviour(the devices could not join network forever,seems like ZC don't process "Update Device" correctly),I have been resolved this issue recently,the following segments was my workaround.
/**************************************************************************** * @fn bdb_TCProcessJoiningList * * @brief Process the timer to handle the joining devices if the TC link * key is mandatory for all devices * * @param none * * @return none */ void bdb_TCProcessJoiningList(void) { bdb_joiningDeviceList_t* tempJoiningDescNode; if(bdb_joiningDeviceList) { tempJoiningDescNode = bdb_joiningDeviceList; while(tempJoiningDescNode) { if(tempJoiningDescNode->NodeJoinTimeout) { tempJoiningDescNode->NodeJoinTimeout--; } if(tempJoiningDescNode->NodeJoinTimeout == 0) { //Check if the key exchange is required if(bdb_doTrustCenterRequireKeyExchange()) { AddrMgrEntry_t entry; entry.user = ADDRMGR_USER_DEFAULT; osal_memcpy(entry.extAddr,tempJoiningDescNode->bdbJoiningNodeEui64, Z_EXTADDR_LEN); if(AddrMgrEntryLookupExt(&entry)) { ZDSecMgrAPSRemove(entry.nwkAddr,entry.extAddr,tempJoiningDescNode->parentAddr); } //Expired device either is legacy device not using the TCLK entry or got //removed from the network because of timeout, eitherway it is not using //TCLK entry neither the Security user in the address manager, so free the entry //in both tables. uint16 keyNvIndex; uint16 index; APSME_TCLKDevEntry_t TCLKDevEntry; uint8 found; //Remove the entry in address manager ZDSecMgrAddrClear(tempJoiningDescNode->bdbJoiningNodeEui64); //search for the entry in the TCLK table keyNvIndex = APSME_SearchTCLinkKeyEntry(tempJoiningDescNode->bdbJoiningNodeEui64,&found, NULL); //If found, erase it. if(found == TRUE) { osal_memset(&TCLKDevEntry,0,sizeof(APSME_TCLKDevEntry_t)); TCLKDevEntry.keyAttributes = ZG_DEFAULT_KEY; //Increase the shift by one. Validate the maximum shift of the seed which is 15 index = keyNvIndex - ZCD_NV_TCLK_TABLE_START; TCLinkKeyFrmCntr[index].rxFrmCntr = 0; TCLinkKeyFrmCntr[index].txFrmCntr = 0; //Update the entry osal_nv_write(keyNvIndex,0,sizeof(APSME_TCLKDevEntry_t), &TCLKDevEntry ); } if(pfnTCLinkKeyExchangeProcessCB) { bdb_TCLinkKeyExchProcess_t bdb_TCLinkKeyExchProcess; osal_memcpy(bdb_TCLinkKeyExchProcess.extAddr,tempJoiningDescNode->bdbJoiningNodeEui64, Z_EXTADDR_LEN); bdb_TCLinkKeyExchProcess.status = BDB_TC_LK_EXCH_PROCESS_EXCH_FAIL; bdb_SendMsg(bdb_TaskID, BDB_TC_LINK_KEY_EXCHANGE_PROCESS, BDB_MSG_EVENT_SUCCESS,sizeof(bdb_TCLinkKeyExchProcess_t),(uint8*)&bdb_TCLinkKeyExchProcess); } } //Free the device from the list bdb_TCJoiningDeviceFree(tempJoiningDescNode); } tempJoiningDescNode = tempJoiningDescNode->nextDev; } } //we are done with the list if(bdb_joiningDeviceList == NULL) { osal_stop_timerEx(bdb_TaskID,BDB_TC_JOIN_TIMEOUT); } }