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

How to use flash_manager.c

In mesh2.1.1\examples\light_switch\proxy_server I find this flash_manager.c file.Its purpose is to store/resorre/remove DSM&access data.

My flash function referred to access.c.But I found a problem.

If node is provisioning or provides completion, calling flash_manager_remove() and mesh_stack_device_reset(), it can reinitialize this flash.

If it's new node.,calling flash_manager_remove() and mesh_stack_device_reset().After waiting for the node to restart,I try to read(flash_manager_add()&flash_manager_entry_get()&flash_manager_entry_next_get()),old data can be get.

This is unreasonable.

Parents Reply Children
  • Hi,

    I know remove_complete_cb will be called when the remove operation is finished.But,if it's new node,calling flash_manager_remove() ,cannot be triggered remove_complete_cb.

    You can try this(proxy_server):

    Button 3 is used to calling flash_manager_remove() reset this node.If remove_complete_cb was already calling,it will be blink all LEDs;If not,blink LED1 Indicates that node are currently busy.

    Download proxy_server demo for nRF52832(in advance Erase the device flash).

    Press the button 3 for the firs,LED1 blink,that means not implemented remove_complete_cb.

    Press the button 3 again,all LEDs will blink,now,that's the real erase&reset success.

    If use APP configured node,once push button 3 will be succeeded.

    Why is this?

  • Hi,

    I do not know if I quite understand what you mean, but button 3 only clears the configuration and resets the device if it has been provisioned. If the device is not yet provisioned it will print a log message stating "The device is unprovisioned. Resetting has no effect.\n" That should explain why the node resets after configuration.

    The easiest way to see what happens to the node is to do a session where you get the log messages. Either through a SES debug session, or by connecting to RTT. Looking only at the LEDs may be misleading, in particular because it is hard to follow what happens when multiple states are indicated within a short period of time.

    Regards,
    Terje

  • I know what you mean.But print a log message stating "The device is unprovisioned. Resetting has no effect.\n"  was from MESH 2.2.0,if when MESH 2.1.1 push button 3 it will Direct calling mesh_stack_config_clear()&node_reset().That is to say,if the device is not yet provisioned we shouldn't calling mesh_stack_config_clear()&node_reset().So,in the MESH 2.1.1 button 3 has a BUG?This BUG has the following effects:

    press the first is fail.

    press again will success.

  • Hi,

    I am afraid I still do not understand what you mean. Have you found a bug in nRF5 SDK for Mesh v2.1.1, that is not present in nRF5 SDK for Mesh v2.2.0? In that case it has been fixed?

    If it is still present in nRF5 SDK for Mesh v2.2.0, what are the steps to reproduce?

    Regards,
    Terje

  • Hi,

    You can compare between 2.1.1&2.2.0 about "main.c"file,"button_event_handler()" function,"case 3:"handle.Also can between 2.1.1&2.2.0 try to press the button 3 again and again,then I think you can know my mean.

Related