This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Correct handling of flash manager required

Dear Support

I’m having a problem erasing the network configuration data in the flash.

We are using nrf5_SDK_for_Mesh_v2.0.1 with the flash manager according to this post:

storing-values-using-flash-manager

Now I need to:

  1. add production parameters in the flash which shall never be erased anymore
  2. erase the network data in the flash to use the device in a new network

What I did:

  • store the the network data as adviced in the ticket above
  • store the production value in a new page independent from network configuration data
    I add a new area for the production data using flash_manager_add()with a new instance of the flash manager
    => works fine so far

The problem starts when I want to completely erase the network configuration data in the flash.

Idea / what I tried:

  • As I understand that there are different flash managers (several instances), I want to remove the flash manager of the network configuration using flash_manager_remove() with the instance of the network configuration values.
    (The flash area with the production values should not be concerned)
  • Then I would like to restart the device and initialize network area again by calling flash_manager_add()

Doing this I have the same problem which is reported in this ticket
flash-manager-not-working-before-mesh_init-in-proxy_server-main-c

=> There you write, that flash manager are initialized by the Mesh stack and shouldn’t be initialized by myself. => how can I stored data in the flash then?

=> I understand that I should use the flash manager for this purpose according to the first link in this ticket.

What I get after I restart the device:  app_error_weak.c, 95, Mesh assert at 0x000317EC (:0)

Some more information about my investigations:

  • even I just remove the flash handler which I created, the callback function flash_remove_complete() in access.c is called
    static void flash_remove_complete(const flash_manager_t * p_manager)
    {
       mark_all_as_outdated();
       add_flash_manager();
    }
    => this results in a problem as this flash manager was not removed and therefore the check flash_area_is_valid() results false.
  • same thing for device_state_manager(): also this flash manager is called also resulting in a problem.
  • Restarting the device again (power cycle) results in correct behavior:
    • my nodelist of the network is gone
    • my production values are still available

 In the infocenter the documentation about flash_manager_remove()I read:

Remove the given flash manager, and erase all of its contents.

All entries known to this manager will become permanently inaccessible and forgotten. If set, the managers remove_complete_cb (flash_manager_remove_complete_cb_t) will be called at the end of this operation. Only at that point will it be safe to reuse the flash area, or re-add the flash manager.

It looks like this does not work!

=> can you please tell me how

  • to stored values in the flash which are stored permanent separately from the network configuration
  • cleanup existing network values completely and create a new network

 thank you for your support

Parents Reply Children
  • Investigations and many tests showed, that the reported problem is not the root cause of the problem we have, but just a side effect.

    Basically the procedure for deleting the network configuration and restarting the device:

    • mesh_stack_config_clear()
    • flash_manager_remove()
    • mesh_stack_device_reset()

    works in principle when using mesh SDK.

    •  Therefore I propose you remove this ticket

     Still we have problems in the area of

    • provisioning in interaction with flash
    • coexistence of Mesh with BLE and DFU

    ... but these issues we handle in other tickets if we can’t solve them.

Related