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

DFU Mesh over BLE

Hi.

I have problem with dfu over ble with mesh sdk. I use example experimental_lpn as guide. When I add this dfu functionality in my project, my application is not responding. It seems that this issue appears in function nrf_mesh_dfu_cmd_send() in nrf_mesh_dfu_init(). It looks like infinite loop. I dont see any error messages or asserts.

My log output:

<t:          0>, main.c,  300, ----- BLE Mesh Light Switch Server Demo-----
<info> app: Setting vector table to bootloader: 0x000F8000
<info> app: Setting vector table to main app: 0x00026000
<info> app: ble_dfu_buttonless_backend_init after
<info> app: sd_ble_gatts_service_add after
<info> app: sd_ble_uuid_vs_add after
<info> app: ble_dfu_buttonless_char_add after
<t:       9514>, main_mesh.c,  111, BEFORE mesh_stack_init
<t:       9520>, mesh_stack.c,   72, BEFORE nrf_mesh_init
<t:       9990>, nrf_mesh_dfu.c,  644, AFTER dfu_cmd_handler_set
<t:       9997>, nrf_mesh_dfu.c,  656, AFTER rand_prng_seed
<t:      10009>, nrf_mesh_dfu.c,  675, BEFORE nrf_mesh_dfu_cmd_send

My code in nrf_mesh_dfu_init():

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "BEFORE nrf_mesh_dfu_cmd_send")
    error_code = nrf_mesh_dfu_cmd_send(&init_cmd);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "AFTER nrf_mesh_dfu_cmd_send");

Parents
  • Hi Zhenya, 

    Have you performed a test with the experimental_lpn DFU over BLE ? Did it work ?

    Please be ware that the DFU over BLE is not related to the standard Mesh DFU. The reason is that LPN node doesn't support Mesh DFU so we do a normal BLE DFU. 

    Don't think you should call nrf_mesh_dfu_cmd_send(). 

    You should call ble_dfu_support_service_init() instead. And also please be aware that you need to flash the nRF5 SDK's bootloader, not the mesh bootloader. 

    Please follow the documentation here

  • Thank you for your answer.

    Normal BLE DFU is what I need in my project. I want to update davices one by one.


    Yes, I called function ble_dfu_support_service_init(). Function nrf_mesh_dfu_cmd_send() was called by nrf_mesh_dfu_init() in nrf_mesh_init(). My mistake was that I did not add source file nrf_mesh_weak() instead of nrf_mesh_dfu() in ses project. When I did this my issue was solved. But i have some more questions:

    1) How can I flash device with application with bootloader? Now I firstly flash secure_bootloader and than via android app nrfConnect flash my application over dfu.

    2) Can I debug application in ses, which was flashed over dfu?

  • Hi,

    1) You do DFU as a normal BLE DFU. What you described is correct. Note that you can also flash application via the programmer, but you would need to generate and flash bootloader setting. Have  a look at appendix 1 in this guide. 

    2) Yes, you can debug it as normal application. If the bootloader forward the PC to the application as normal, you should be able to stop at the breakpoint when debugging. 

  • Thank you.

    1) Can I combine softdevice + bootloader + bootloader_settings + application using this tool (mergehex)?

    2) Can I flash device using nrfjprog without chip erase?

    And debug does not work. My steps for debug:

    1. 

    nrfjprog --family NRF52 --program s140_nrf52_6.1.0_softdevice.hex --chiperase --verify

    Result:  

    Parsing hex file.
    Erasing user available code and UICR flash areas.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.
    Verifying programming.
    Verified OK.

    2.  

    nrfutil settings generate --family NRF52840 --application my_application.hex --application-version 0 --bootloader-version 0 --bl-settings-version 1 bootloader_setting.hex

    Result:  

    Note: Generating a DFU settings page with backup page included.
    This is only required for bootloaders from nRF5 SDK 15.1 and newer.
    If you want to skip backup page generation, use --no-backup option.
    
    Generated Bootloader DFU settings .hex file and stored it in: bootloader_setting.hex
    
    Bootloader DFU Settings:
    * File:                     bootloader_setting.hex
    * Family:                   NRF52840
    * Start Address:            0x000FF000
    * CRC:                      0x6CC3289F
    * Settings Version:         0x00000001 (1)
    * App Version:              0x00000000 (0)
    * Bootloader Version:       0x00000000 (0)
    * Bank Layout:              0x00000000
    * Current Bank:             0x00000000
    * Application Size:         0x0003F700 (259840 bytes)
    * Application CRC:          0xB6CB1594
    * Bank0 Bank Code:          0x00000001
    * Softdevice Size:          0x00000000 (0 bytes)
    * Boot Validation CRC:      0x00000000
    * SD Boot Validation Type:  0x00000000 (0)
    * App Boot Validation Type: 0x00000000 (0)

    3. 

    mergehex --merge bootloader_setting.hex secure_bootloader_ble_s140_pca10056.hex --output merged_bootloader.hex

    Result:  

    Parsing input hex files.
    Merging files.
    Storing merged file.

    4. 

    nrfjprog --family NRF52 --program merged_bootloader.hex --verify

    Result:  

    Parsing input hex files.
    Merging files.
    Storing merged file.
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    Verifying programming.
    Verified OK.

    5. 

    nrfjprog --family NRF52 --reset

    Result:  

    Applying system reset.
    Run.

    6. Than I go to ses, press "Debug" -> "Go". Ses downloading "my_application.elf" and going to the debug mode.

    7. And ses showing "Running...", but "Restart" or breakpoints has no effect. And led is not blinking. Looks like application is not running.

  • Before testing with debugging, could you please test the bootloader and do DFU for testing ? Please follow my guide in the blog to do a DFU test with the nRF5 SDK first (no mesh) . 

    Please open RTT and look for the log of the bootloader. Make sure your bootloader works fine and you can do normal DFU update. 

    After that, follow what we have in this guide.

Reply Children
Related