How implemented the Installation Codes for kw41z zigBee

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How implemented the Installation Codes for kw41z zigBee

1,747件の閲覧回数
yaroslav_kyryle
Contributor I

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.

pastedImage_4.png

Could you help me with solving this problem?

0 件の賞賛
返信
1 返信

1,537件の閲覧回数
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

We usually recommend that you use the example available in the stack as those are already tested

 Please check the ZigBee 3.0 Stack User Guide available in the KW41Z SDK in the following path.

<installation path>\docs\wireless\Zigbee

Something that I could notice it's that you are not following completely the recommendations of the APIs described in the user guide and yet using some of those functions like the following one. In chapter 5.8.3 Setting Up ZigBee Security

"Security can be set up in the application code using the function ZPS_vAplSecSetInitialSecurityState(), which must be called before ZPS_eAplAfInit()"

As this it's your custom implementation we can't really be sure in which part it is having the issue as according to the error message the link between the node it's not being correctly established, there are those calls not correctly used but in our stack we also have some libraries that you will need to implement in order to make your stack work.  I would recommend you to use the available information and examples in the SDK.

Regards,
Estephania

0 件の賞賛
返信