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

Issue with mesh_config_clear() and MESH_CONFIG_STRATEGY_ON_POWER_DOWN

When mesh_config_clear() is called with a setup containing a file strategy MESH_CONFIG_STRATEGY_ON_POWER_DOWN and an entry in that file has been changed but not yet written to the backend, the internal state of that entry will retain it's dirty flag.

The issue is within dirty_entries_process() as the return code from mesh_config_backend_erase() is NRF_ERROR_NOT_FOUND but the code wrongly assumes it to be NRF_ERROR_NO_MEM.

This issues causes mesh_config_is_busy() to return true despite flash_manager_is_stable() returning true.

The following patch solves the issue by clearing the dirty flag if NRF_ERROR_NOT_FOUND is returned.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/mesh/core/src/mesh_config.c b/mesh/core/src/mesh_config.c
index ae2c2ef..5e900d1 100644
--- a/mesh/core/src/mesh_config.c
+++ b/mesh/core/src/mesh_config.c
@@ -167,6 +167,11 @@ static void dirty_entries_process(void)
p_params->p_state[j] &= (mesh_config_entry_flags_t)~MESH_CONFIG_ENTRY_FLAG_DIRTY;
p_params->p_state[j] |= MESH_CONFIG_ENTRY_FLAG_BUSY;
}
+ else if (status == NRF_ERROR_NOT_FOUND)
+ {
+ /* This can only happen with mesh_config_backend_erase() */
+ p_params->p_state[j] &= (mesh_config_entry_flags_t)~MESH_CONFIG_ENTRY_FLAG_DIRTY;
+ }
else
{
/* Back off if the backend call fails, to allow it to free up some resources */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Mesh SDK 3.2.0.

Thanks.

Parents
  • Hi,

    Thanks for reporting this. I have reported this internally. I will update you when I get a repsonse.

  • Hi,

    Sorry for not giving an update. 

    The team comfirmed that this was a bug and your suggested patch is correct. The fix will be released in a later version of the Mesh SDK.

Reply
  • Hi,

    Sorry for not giving an update. 

    The team comfirmed that this was a bug and your suggested patch is correct. The fix will be released in a later version of the Mesh SDK.

Children
No Data