Hi,
Greetings!
I am facing a issue while updating firmware
My Setup:
SDK 16.0.0
SDK for Mesh 4.0.0
nRF52832
DFU: secure_bootloader_ble_s132_pca10040
Application: light_switch_server with modifications as per our application requirements
Key modifications:
1. Using "flash_manager" API to store application data
2. Flash memory location reserved with "ProgramSection" as below
<ProgramSection alignment="0x1000" keep="Yes" load="Yes" name=".application_status" size="0x00001000" inputsection="*(SORT(.application_status))" address_symbol="__start_application_status" end_symbol="__stop_application_status" />
3. I have not given specific memory location and used "__start_application_status" i.e. address_symbol to get address in flash
4. Then I used this flash address while calling flash_manager_add()
Issue: Device fails on 2nd time firmware update, gives mesh assert error
Steps to reproduce:
1. Flashed DFU example into nRF52 DK
2. Using nRF Connect on desktop uploaded application firmware along with softdevice onto nRF52 DK
3. At this stage device works well
4. Now again uploaded application firmware along with softdevice onto nRF52 DK. Here please note that I am not reprogramming DFU
5. Now I am getting Mesh assert error
Debugging:
1. I tried to debug the issue and I found that in flash_manager API in flash_manager_add() call assert is occuring
2. Further it is observed that in flash_area_is_valid() call, metadata_is_valid() call returns true
3. However page_index is not matching and asserting (at line no 262: "NRF_MESH_ASSERT(p_manager->config.p_area[i].metadata.page_index == 1")
4. I have observed below points
metadata_len = 118
page_index = 53
pages_in_area = 4 (expected value to be '1')
It looks like that on 2nd time bootloading application, these reserved memory locations (metadata) gets corrupted and it is causing mesh assert issue
If is it so then how can I avoid this condition?
If no what could be the possible reason?
Thanks in advance.
Regards,
Dinesh