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

mesh_config_entry_get()/mesh_config_entry_set() are not working as expected

Hi all,

I am developing on nRF Mesh SDK 4.0.0 with nRF52833 DK (PCA10100).

To save/restore persistent model state to flash, I added the code using mesh_config_entry_get()/mesh_config_set() functions as below.

1. I added mesh_config_entry_get() in model initialization function.

   It will fail if there is no entry in flash, but after saved once, it can read it afterwards.

2. I also added mesh_config_entry_set() function in model set callback.

    When I send a set message, log shows that this function call is successful, i.e. returns NRF_SUCCESS.

But, when I power cycled the board, it still cannot get the entry and mesh_config_get() always failed.

What is wrong/missing in my code? Can somebody advice about?

TIA.

Parents
  • Hi Choe, 

    Could you let me know how you define your config ID , have you followed what we did, for example in mesh_opt_provisioner.h in the light switch provisioner example ? 

    You need to define config file using MESH_CONFIG_FILE().

    Please note that you can store your data using the flash library directly by creating your own flash area outside of the mesh config area. You can call this: mesh_stack_persistence_flash_usage() to know the mesh stack flash usage and allocate your own flash area outside of the mesh stack. 

  • I found what is the problem.

    my model_config_load() call is too early in model_init_cb(), so it failed.

    And also I figured out that mesh_config_load() automatically includes loading each of my custom entries.

    So, because mesh_config_load(0 will call getter/setter for my entries, I added memcpy() inside getter/setter, even it seems to be redundant.

    After then, it works fine.

Reply Children
No Data
Related