Other Parts Discussed in Thread: SYSCONFIG
simplelink_cc13x2_26x2_sdk_3_40_00_02
1. Removing board constraints in SysConfig with "Custom Board" button causes unexpected build or runtime behavior.
Refer to this E2E FAQ: https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/t/864899
2. Joining device (ZR/ZED) ignores PAN ID config settings and incorrectly associates when two ore more Zigbee networks respond to a beacon.
Apply the following code changes to bdb.c:
void bdb_filterNwkDisc(void)
{
networkDesc_t* pNwkDesc;
uint8_t i = 0;
uint8_t ResultCount = 0, ResultTotal = 0; //CHANGE THIS LINE
pBDBListNwk = nwk_getNwkDescList();
nwk_desc_list_release();
pNwkDesc = pBDBListNwk;
while (pNwkDesc)
{
ResultCount++;
pNwkDesc = pNwkDesc->nextDesc;
}
ResultTotal = ResultCount; //ADD THIS LINE
if(pBDBListNwk)
{
pNwkDesc = pBDBListNwk;
if(pNwkDesc)
{
for ( i = 0; i < ResultTotal; i++, pNwkDesc = pNwkDesc->nextDesc ) //CHANGE THIS LINE
...
3. A malloc with size of zero will cause HEAPMGR_ASSERT
Place heapInitialize=1 after HEAPMGR_INIT calls HEAPMGR_MALLOC(0) in rtos_heaposal.h
4. Incorrect source offset results in NV corruption
Make the following change inside of nvocmp.c:
static bool NVOCMP_findSignature(uint8_t pg, uint16_t *pSrcOff)
{
uint16_t i;
uint16_t rdLen;
uint8_t readBuffer[NVOCMP_XFERBLKMAX];
uint16_t srcOff = *pSrcOff;
uint16_t endOff = NVOCMP_PGDATAOFS + NVOCMP_ITEMHDRLEN - 1;
while(srcOff > endOff)
{
rdLen = (srcOff - NVOCMP_XFERBLKMAX > endOff) ? NVOCMP_XFERBLKMAX : srcOff - endOff;
srcOff -= rdLen;
NVOCMP_read(pg, srcOff, readBuffer, rdLen);
for(i = rdLen; i > 0; i--)
{
if(readBuffer[i-1] == NVOCMP_SIGNATURE)
{
// Found possible header, resume normal operation
NVOCMP_ALERT(FALSE, "Found possible signature.")
srcOff += (i); //CHANGE THIS LINE
*pSrcOff = srcOff;
return(true);
}
}
}
return(false);
}
5. Zigbee devices do not rejoin (after a reset) if using install codes
Solution:
In bdb_StartCommissioning, replace the contents between the "#ifdef ZG_BUILD_JOINING_TYPE" and "#endif //ZG_BUILD_JOINING_TYPE" with:
#ifdef ZG_BUILD_JOINING_TYPE
//Only for joining devices validate the joining procedure
if(ZG_DEVICE_JOINING_TYPE)
{
//If we got into a network
if(!OsalPort_isBufSet( AIB_apsTrustCenterAddress, 0x00, Z_EXTADDR_LEN ))
{
//Which is not distributed
if(!APSME_IsDistributedSecurity())
{
uint8_t found;
uint16_t entryIndex;
APSME_TCLinkKeyNVEntry_t APSME_TCLKDevEntry;
entryIndex = APSME_SearchTCLinkKeyEntry(AIB_apsTrustCenterAddress, &found, &APSME_TCLKDevEntry);
//If we must perform the TCLK exchange and we didn't complete it, then reset to FN
if(requestNewTrustCenterLinkKey && (APSME_TCLKDevEntry.keyAttributes != ZG_NON_R21_NWK_JOINED) && (APSME_TCLKDevEntry.keyAttributes != ZG_VERIFIED_KEY))
{
if(entryIndex < gZDSECMGR_TC_DEVICE_MAX)
{
//Force to initialize the entry
memset(&APSME_TCLKDevEntry,0,sizeof(APSME_TCLinkKeyNVEntry_t));
APSME_TCLKDevEntry.keyAttributes = ZG_DEFAULT_KEY;
osal_nv_write_ex(ZCD_NV_EX_TCLK_TABLE, entryIndex,
sizeof(APSME_TCLinkKeyNVEntry_t),
&APSME_TCLKDevEntry);
TCLinkKeyRAMEntry[entryIndex].txFrmCntr = 0;
TCLinkKeyRAMEntry[entryIndex].rxFrmCntr = 0;
TCLinkKeyRAMEntry[entryIndex].entryUsed = FALSE;
}
//reset the device parameters to FN
bdbAttributes.bdbNodeIsOnANetwork = FALSE;
osal_nv_write(ZCD_NV_BDBNODEISONANETWORK, sizeof(bdbAttributes.bdbNodeIsOnANetwork), &bdbAttributes.bdbNodeIsOnANetwork);
zgWriteStartupOptions(ZG_STARTUP_SET, ZCD_STARTOPT_DEFAULT_CONFIG_STATE | ZCD_STARTOPT_DEFAULT_NETWORK_STATE);
//Then start the commissioning process requested
bdbCommissioningProcedureState.bdbCommissioningState = BDB_COMMISSIONING_STATE_START_RESUME;
OsalPort_setEvent( bdb_TaskID, BDB_CHANGE_COMMISSIONING_STATE );
return;
}
}
}
}
#endif //ZG_BUILD_JOINING_TYPE
And in function ZDSecMgrTransportKeyInd of zd_sec_mgr.c, use this (ie fix is in the else block):
// If entry is found with keyAttribute ZG_PROVISIONAL_KEY, update extAddr and write to NV
if(status == SUCCESS)
{
OsalPort_memcpy(TCLKDevEntryCpy.extAddr, ind->srcExtAddr, Z_EXTADDR_LEN);
//Save the KeyAttribute for joining device
osal_nv_write_ex(ZCD_NV_EX_TCLK_TABLE, entryIndex,
sizeof(APSME_TCLinkKeyNVEntry_t),
&TCLKDevEntryCpy);
}
else
{
// Find TCLK entry with TC extAddr or first unused entry
uint8_t entryFound;
entryIndex = APSME_SearchTCLinkKeyEntry(AIB_apsTrustCenterAddress,&entryFound,&TCLKDevEntryCpy);
if(entryIndex < gZDSECMGR_TC_DEVICE_MAX)
{
OsalPort_memcpy(TCLKDevEntryCpy.extAddr, ind->srcExtAddr, Z_EXTADDR_LEN);
//Save the KeyAttribute for joining device
osal_nv_write_ex(ZCD_NV_EX_TCLK_TABLE, entryIndex,
sizeof(APSME_TCLinkKeyNVEntry_t),
&TCLKDevEntryCpy);
}
}
Regards,
Ryan