AnsweredAssumed Answered

How implemented the  Installation Codes for kw41z zigBee

Question asked by Yaroslav Kyrylenko on Aug 6, 2019
Latest reply on Aug 7, 2019 by Estephania Martinez

Hi!.

 

Now I working on the custom implementation  of ZigBee. And I would like to add the security level. I use two devices for debugging. 1. The Coordinator with ble_zigbee_coordinator firmware. 2. My device consists of the router with the capability end device. 

To my device, I added the following code:

PUBLIC uint8 au8DefaultTCLinkKey[16] =
{ 0x5a, 0x69, 0x67, 0x42, 0x65, 0x65, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x30, 0x39 };

 

/*
* @brief Initialises the application related functions
* @return ERR_OK - on successful operation, error code otherwise
**/
PUBLIC uint32_t zBee_initRouterNode(void)
{
uint16 u16ByteRead;
PDM_teStatus eStatusReportReload;
uint32_t u32_returnValue = ERR_OK;
/* Stay awake */
PWRM_teStatus pwrmRet = PWRM_eStartActivity();
if(pwrmRet != PWRM_E_OK)
{
u32_returnValue = ERR_INIT;
}

sNodeState.eNodeState = E_STARTUP;
PDM_teStatus pdm_retValue = PDM_eReadDataFromRecord(PDM_ID_APP_ROUTER, &sNodeState, sizeof(tsNodeState), &u16ByteRead);
if(pdm_retValue != PDM_E_STATUS_OK)
{
u32_returnValue = ERR_INIT;
}

/* Restore any report data that is previously saved to flash */
eStatusReportReload = eRestoreReports();


ZPS_u32MacSetTxBuffers (4);


ZPS_psAplAibGetAib()->bUseInstallCode = BDB_JOIN_USES_INSTALL_CODE_KEY;

zBee_initMacAddr();

/* Initialise ZBPro stack */
ZPS_eAplAfInit();

ZPS_vAplSecSetInitialSecurityState(ZPS_ZDO_PRCONFIGURED_INSTALLATION_CODE,
au8DefaultTCLinkKey,
0x00,
ZPS_APS_GLOBAL_LINK_KEY);

if(sNodeState.eNodeState != E_RUNNING)
{
BDB_vNfSetPanID((uint16) RND_u32GetRand ( 1, 0xfff0 ) );
}
/* Initialise ZCL */
zBee_zclInit();
uint16_t panIdValue = BDB_vNfGetPanID();

/* Initialise other software modules
* HERE
*/
zBee_bdbInit();

/* Always initialise any peripherals used by the application
* HERE
*/
u8AssociatuionAttempts = 0;
//u8AssociatuionAttempts = ASSOCIATION_ATTEMPTS;

 

/* The functions u8PDM_CalculateFileSystemCapacity and u8PDM_GetFileSystemOccupancy
* may be called at any time to monitor space available in the eeprom */
// TODO don't know if they exist DBG_vPrintf(TRACE_APP, "PDM: Capacity %d\r\n", u8PDM_CalculateFileSystemCapacity() );
// TODO don't know if they exist DBG_vPrintf(TRACE_APP, "PDM: Occupancy %d\r\n", u8PDM_GetFileSystemOccupancy() );

DBG_vPrintf(TRACE_APP, "Start Up StaTe %d On Network %d\r\n",
sNodeState.eNodeState,
sBDB.sAttrib.bbdbNodeIsOnANetwork);

/*Load the reports from the PDM or the default ones depending on the PDM load record status*/
if(eStatusReportReload !=PDM_E_STATUS_OK )
{
/*Load Defaults if the data was not correct*/
vLoadDefaultConfigForReportable();
}
/*Make the reportable attributes */
vMakeSupportedAttributesReportable();

zBee_printAPSTable();

return u32_returnValue;
}

 

And added change to app_zps_cfc.h

 

/*! Specify a type of security */
/*! ZPS_ZDO_NO_NETWORK_KEY/ZPS_ZDO_PRECONFIGURED_LINK_KEY/
ZPS_ZDO_DISTRIBUTED_LINK_KEY/ZPS_ZDO_PRCONFIGURED_INSTALLATION_CODE */
#define ZPS_ZDO_NWK_KEY_STATE ZPS_ZDO_PRCONFIGURED_INSTALLATION_CODE

 

Also, I added  to the  NXP IoT Toolbox  mobile application, my install code 

 


code 99e7e404a31adf8b 
5a6967426565416c6c69616e63653039

But  when I was  trying to connect my device to coordinator I got next errors.

 

 

Could you help me with solving this problem?

 

Outcomes