This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1352P: Reset the NV (nvocmp) memory to a factory new state

Part Number: CC1352P


What's the correct/simplest way to reset the on-chip NV memory to a factory new state? 

I know I can use Zstackapi_bdbResetLocalActionReq to reset the stack and zstack_user0Cfg.nvFps.deleteItem to remove individual NVINTF_SYSID_APP items, but I was thinking there might be a more direct way.

  • Hi Bill,

    Zstackapi_bdbResetLocalActionReq is the recommended method inside Zigbee applications (typically with the appServiceTaskId parameter) to perform a factory reset.  This is further show in zcl_sampleapps_ui.c file where it is used for the UART CUI (uiActionResetToFactoryNew) and from a push button on startup (UI_Init).  Both show how a callback (uiAppFNResetCB) could be utilized to handle custom NV memory requirements.  You can also refer to the Z-Stack API Guide if you have any other API needs.  processBdbResetLocalActionReq is the function called immediately  which leads to bdb_resetLocalAction and bdb_setFN & ZDAp_ResetTimerStart.

    Since the ZNP does not have an on-board application, the process is slightly different.  A MT_SYS_RESET_SOFT or MT_SYS_RESET_HARD command calls SysCtrlSystemReset to perform a full system reset, but first you must make sure that the startup options are set to clear NV by using SYS_OSAL_NV_WRITE with ID = 0x03 (ZCD_NV_STARTUP_OPTION), offset = 0x00, length = 0x01, and value = 0x03 (ZCD_STARTOPT_DEFAULT_CONFIG_STATE | ZCD_STARTOPT_DEFAULT_NETWORK_STATE) parameters.  Please refer to the Monitor and Test API for more information.

    Regards,
    Ryan

  • I suppose you can call bdb_resetLocalAction directly in your application to reset the on-chip NV memory to a factory new state.

  • Hmmm. bdb_resetLocalAction simply calls bdb_setFN which in turn sets the ZCD_NV_STARTUP_OPTION.  This does not reset any user/app NVs that are added using nvId.systemID = NVINTF_SYSID_APP; 

    Most of the uiAppFNResetCB examples that Ryan mentioned are empty,  The ones that do something seem to use zstack_user0Cfg.nvFps.deleteItem to individually reset non-stack related NVs.

    I see in nvocmp.c there is a NVOCMP_FORCE_CLEAN action that occurs during initialization when its felt that the NV system is corrupt.  But there is no api to do a clean.

    I also see a comment in nvocmp.c on using nvFps.doNext.  I think if I use the NVINTF_DOANYID flag it will delete all entries.  This scheme isn't as complete as a CLEAN, and doesn't actually return the NV systems to a new state, but I guess it may work for what I need,

    Thanks