We encountered a problem when added new models through an OTA DFU.Specifically we upgraded a device with SoftDevice 6.1.0, SDK 15.2 and Mesh SDK 3.1.0 to SoftDevice 7.0.1, SDK 16.0 and Mesh SDK 4.0.0.
We made this upgrade so we can have LPN devices. We have also added new models to support the LPN devices.
For unprovisioned devices the upgrade runs smoothly.For provisioned devices mesh initialization fails in the mesh_stack_init call with NRF_ERROR_INVALID_DATA.
From the looks of it the problem is in access.c where the access_metadata_setter method gives an error due to the addition of the new model.
static uint32_t access_metadata_setter(mesh_config_entry_id_t id, const void * p_entry)
NRF_MESH_ASSERT_DEBUG(MESH_OPT_ACCESS_METADATA_RECORD == id.record);
access_flash_metadata_t * p_metadata = (access_flash_metadata_t *)p_entry;
if (p_metadata->element_count == ACCESS_ELEMENT_COUNT &&
p_metadata->model_count == ACCESS_MODEL_COUNT &&
p_metadata->subscription_list_count == ACCESS_SUBSCRIPTION_LIST_COUNT)
m_status.is_metadata_stored = 1;
As I read the specification when the number of elements the behavior should be different: The Mesh Profile specification v1.0 (and v1.0.1) in section 2.3.4 Elements states:
If the number and structure of elements changes, for example due to a firmware update, the node must be reprovisioned. The Node Removal procedure (see Section 3.10.7) is used when a firmware update is performed that changes the number or structure of elements.
We implemented this behavior by erasing the config pages and then restarting the device, should the mesh_stack_init call return NRF_ERROR_INVALID_DATA. We then provision the device again through our accompanying phone app.
Thanks for reporting this.
I'll forward this to our Mesh developers, so that we can investigate if this is a bug on our side.
Best regards, Joakim Jakobsen