I have a node running with the SDK for Mesh v3.1.0. It crashes during boot up in restore_addresses_for_model() due to dsm_address_subscription_add_handle() returning NRF_ERROR_NOT_FOUND.
This is because nothing has been restored from flash for DSM.
In mesh_stack_init() the return value from dsm_flash_config_load() is ignored and access_flash_config_load() is called regardless.
(void) dsm_flash_config_load();
(void) access_flash_config_load();
Wouldn't it make more sense to erase the access flash area in case the DSM failed to load as access depends on DSM?
dsm_flash_config_load() fails because it can't read the dsm metadata entry. I have no clue into how it could have been lost.
A hexdump of the DSM flash area. It doesn't contain the expected DSM_FLASH_HANDLE_METAINFO. It is however sealed.
:10400000080410100100FFFF02000200010004007C :1040100006000030000000D68706571C8FA8CCFE93 :104020005B1938489A8CAE00060000500100000071 :1040300090B51101530FB8BA733987CE72F58F411D :104040000600004000000000E477A7878EC8A8BFE4 :1040500050CD2D0A119EB2FF0200001001C00210C7 :104060000200011002C00A10020002100400011038 :10407000FFFFFF7FFFFFFFFFFFFFFFFFFFFFFFFFD0
The recovery page contains the following, which indicate that a defrag was performed and completed successfully.
:1060000000000000080410100100FFFF0200020061 :10601000FFFF01100200010000800110FFFFFFFFE1 :10602000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
bool dsm_flash_config_load(void)
{
if (!m_flash_is_available)
{
return false;
}
dsm_flash_entry_metainfo_t metainfo;
uint32_t metainfo_size = sizeof(metainfo);
if (flash_manager_entry_read(&m_flash_manager,
DSM_FLASH_HANDLE_METAINFO,
&metainfo,
&metainfo_size) != NRF_SUCCESS)
{
return false;
}
Wouldn't it make sense to call reset_flash_area() if it can't find the metainfo? As the dsm_init() must have created it in case the area was empty?
Thanks.