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

nRF52832 mesh application failed after bootloading

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

  • Hi Dinesh, 

    Please clarify, do you have the issue when testing with the light switch example with no modification ? 

    My understanding here is that you are using the nRF5SDK bootloader instead of the mesh bootloader. 

    Where did you put your custom data with the flash_manager , how many pages ? 

    Please be aware that you need to configure the bootloader to avoid using the area that you used for custom data. This is depict here: https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_bootloader.html?cp=7_1_3_5_0_7#lib_bootloader_memory Please look for the Application Data area. To configure how big the application data area is , have a look here.

    This area is expected to be right behind the start address of the bootloader. 

  • Hi Hung Bui,

    Greetings!

    Your reply is helpful for me

    Please note my reply as below

    1. I am using light switch server example with modifications

    2. I am using bootloader as per bootloader given in experimental_lpn

    3. Currently I am using 2 pages of data and it is part of application itself i.e. I have reserved memory blocks with the help of

    <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" />

    in Project -> Right Click -> Edit Section Placement

    4. As per your reply we can reserve memory blocks by configuring bootloader.

    However please let me know whether it should inclusive of mesh configuration data or not?

    If yes then how can I do that? means how can I understand that how many pages are required for mesh configuration data?

    Please guide. Thanks in advance.

    Regards,

    Dinesh

  • Hi Dinesh, 

    Please clarify that you are using the flash_manager library. 

    How did you call flash_manager_add() ?  In that call you need to configure the start address and the number of page. 

    Usually what you should do is to put your data right before the mesh stack's data which located right before the stack data (please try not to use your data as part of application, you can't preserve it) . You can use this call mesh_stack_persistence_flash_usage() to know where the stack data is and how many pages it's occupying. 

    Then the total pages that the stack and the application uses should be provided to the bootloader (+1 defrag page). So that the bootloader can preserve it. 

  • Hi Hung,

    Greetings!

    Thanks for your reply, it helped me lot.

    Thank you so much!

    Please note that I am using flash_manger_library.

    As per your suggestion, I did use mesh_stack_persistence_usage() to know pages used by stack and address. Then accordingly I placed my application data.

    Also modified bootloader configuration to reserve flash pages.

    After doing all these stuff, issue got resolved.

    Thanks once again.

    Regards,

    Dinesh

Related