Components#

Two main components are used, one on the NCP and one on Host.

On the NCP Side#

The Zigbee Token Interface component is used on the NCP side, which requires the Token Manager component be installed. Token Manager using NVM3 should be installed as well. SimEE2 is not supported. If it is used, the APIS in the Token Interface component will be stubbed and will return a status of SL_STATUS_NOT_AVAILABLE.

The Zigbee Token Interface component provides token access through EZSP commands from the host to read and write the token on the NCP node. The APIs provided are:

uint8_t sli_zigbee_stack_get_token_count(void)

sl_status_t sli_zigbee_stack_get_token_info(uint8_t index, sl_zigbee_token_info_t *tokenInfo)

sl_status_t sli_zigbee_stack_get_token_data(uint32_t token, uint32_t index, sl_zigbee_token_data_t *tokenData)

sl_status_t sli_zigbee_stack_set_token_data(uint32_t token, uint32_t index, sl_zigbee_token_data_t *tokenData)

The component also provides a strong implementation of following function to supply an EUI64 for a restore scenario:

void sl_zigbee_get_restored_eui64(sl_802154_long_addr_t eui64)

Finally, it supplies a reset function to reset the NCP from the host after all the tokens have been restored. With that, the new NCP node gets initialized with the operational EUI64, the network data from restored tokens, and all working RAM tables are populated.

On the Host Side#

The Zigbee Trust Center Backup component is used on the host side. This component is primarily designed to restore a trust center by re-forming the saved network with the same credentials on different hardware. The component performs a backup and restore using the token APIs described in the previous section. These APIs have their EZSP counterparts when called from the host side. The component provides two functions that are implemented to get the token information from the NCP node, save it to a file on the host, and write it back on the new NCP hardware.

As this is designed to restore the entire token system including node EUI, the children on this network do not need to re-establish binding in order to re-form the network.

The following function reads token information and saves it to a file.

sl_status_t sl_zigbee_af_trust_center_backup_save_tokens_to_file(const char* filepath)

The following function reads the saved file and uses token interface APIs to write tokens to the NCP.

sl_status_t sl_zigbee_af_trust_center_backup_restore_tokens_from_file(const char* filepath)

To use the file operations and the above routines on a POSIX system, set the component configuration SL_ZIGBEE_AF_PLUGIN_TRUST_CENTER_BACKUP_POSIX_FILE_BACKUP_SUPPORT to 1.

An EZSP reset function is available to reset the NCP node to initialize the restored token data. The host uses this to reset the NCP after restoring all the tokens, so that the network data gets restored on the working RAM tables.

void sl_zigbee_ezsp_reset_node(void)

Three CLIs are available (one each for the above functions) on the Host as part of the Trust Center Backup component to test the backup and restore:

plugin trust-center-backup backup-tokens <file name to store the tokens>

plugin trust-center-backup restore-tokens <the file with the stored tokens>

plugin trust-center-back reset-node