Factory Reset & Un-provisioning API's in nCS

Hi Team,

We're using nrf52833, nCS V1.9.1 need information on for following things,

1. We need information on API from nCS SDK which un-provision's the device and reset's the BLE connection

2. Information on API which clear's / erases SDK data stored in NV

3. When device is already provisioned using nRF Mesh application, to un-provision the device user needs to press Reset device in mobile app, we want to know what exactly happens in backend when we press reset device does it just reset's the provisioning information / clears its internal memory as well.

Thank you,

Regards,

Hitesh

Parents
  • Hello Hitesh,

    2. Information on API which clear's / erases SDK data stored in NV

    Would you mind expanding a bit on this part? Are you referring to information stored about the mesh network in the settings partition?

    Regards,

    Elfving

  • Yes we want to clear SDK storage which is storing mesh network in Settings partition.

  • Question 1&2: Then you can use bt_mesh_cfg_node_reset in order to do all of this from from another device (usually Provisioner) with configuration client. If you want to reset a device locally (which is not recommended) you can use bt_mesh_reset. One thing to note however is that it does not perform exclusion of the reset node, and trigger key refresh. This should be done manually (use bt_mesh_cdb_node_del to delete the node from CDB. Then refresh the keys).

    Question 3: I will get back to you on this.

    Regards,

    Elfving

  • Question 3: The App is open source, and can be found here: Android & IOS.

    What is happening is that:

    1. The app (iOS or Android) sends Config Node Reset message to the selected device

    2. The device is supposed to remove all network key information and, before that, reply with Config Node Reset Status

    3. At this time, the app removes all information regarding the Node it had, also adding all Unicast Addresses associated to this Node to Exclusion List (so that it cannot be assigned to a new Node until the IV Index is incremented by 2).

    4. The reset device SHOULD remove network keys, but that cannot be guaranteed (some devices may not do this and may continue to send messages to the network).

    5. In order to effectively and completely remove a device from a mesh network a Key Refresh Procedure has to be performed where all OTHER nodes get a new Network Key value, and the one being removed does not. This make it impossible for it to send / receive any more messages to the network.

    Regards,

    Elfving

  • Hi Elfving,

    Thank you for detailed description,

    For query no.2, we need inputs which are not yet clear, I'll rephrase my question, 

    We need information detail about clearing all the data stored by SDK, provisioning information, RPL messages, index, network ID's

    We want to erase the complete sector of SDK data which is of 24kB, 

    is there any api which helps us in erasing this SDK data

    Regards,

    Hitesh

  • I see.

    bt_mesh_cfg_node_reset will make a node to reset only mesh settings in settings subsystem. If there are any other settings stored in settings subsystem, they won't be touched. Another thing is that the mesh settings won't be erased from the flash, but will be marked as deleted (until garbage collector is called).

    If you want to completely erase the settings partition, then there is no such API in settings subsystem. But I think what they can do is to catch when a node is reset by assigning a callback to struct bt_mesh_prov.reset, then initialise `struct nvs_fs` like it is done in `zephyr/samples/subsys/nvs` sample and then call `nvs_clear`. But I'm not sure if it is correct to clear the storage while settings subsystem is initialised. Maybe you will either need to reboot the device right after calling `nvs_clear` or first reboot the device after reset and then clear the settings partition before initalizing the settings subsystem.

    Let me know if you want to go for this option and want me to look further into it.

    Regards,

    Elfving

Reply
  • I see.

    bt_mesh_cfg_node_reset will make a node to reset only mesh settings in settings subsystem. If there are any other settings stored in settings subsystem, they won't be touched. Another thing is that the mesh settings won't be erased from the flash, but will be marked as deleted (until garbage collector is called).

    If you want to completely erase the settings partition, then there is no such API in settings subsystem. But I think what they can do is to catch when a node is reset by assigning a callback to struct bt_mesh_prov.reset, then initialise `struct nvs_fs` like it is done in `zephyr/samples/subsys/nvs` sample and then call `nvs_clear`. But I'm not sure if it is correct to clear the storage while settings subsystem is initialised. Maybe you will either need to reboot the device right after calling `nvs_clear` or first reboot the device after reset and then clear the settings partition before initalizing the settings subsystem.

    Let me know if you want to go for this option and want me to look further into it.

    Regards,

    Elfving

Children
No Data
Related