Mesh OTA couldn't resume after target node reset

Hi,

I use NCS 3.2.4 and 54L15 DK. In the DFU target, I added configuration

CONFIG_DFU_TARGET=Y
CONFIG_DFU_TARGET_MCUBOOT=y
CONFIG_DFU_TARGET_STREAM_SAVE_PROGRESS=y

and also added the following content in dfu_recover function.

static int dfu_recover(struct bt_mesh_dfu_srv *srv,
                       const struct bt_mesh_dfu_img *img,
                       const struct bt_mesh_blob_io **io)
{
    size_t offset = 0;

    int err = dfu_target_mcuboot_offset_get(&offset);
    if (err) {
        printk("Failed to get MCUboot offset (err %d)\n", err);
        offset = 0; 
    }

    printk("Recovering BLOB transfer, already written: %zu bytes\n", offset);

    err = bt_mesh_blob_io_flash_init(&blob_flash_stream,
                                     FIXED_PARTITION_ID(slot1_partition),
                                     offset);
    if (err) {
        return err;
    }    

    *io = &blob_flash_stream.io;
    return 0;
}

After the distributor finished transmitting 3 chunks more, I manually reset the target device. In the RTT window, I entered the shell command: mesh models dfu cli resume, but the command returned error -22.

How can I implement the resume/breakpoint resumption feature for Mesh OTA?

Parents
  • Hello,

    Is there a way for me to test and reproduce what you are seeing? 

    Where exactly did you add CONFIG_DFU_TARGET_STREAM_SAVE_PROGRESS=y?

    Can you try to also add these, unless you already have them?

    CONFIG_DFU_TARGET_STREAM_SAVE_PROGRESS=y
    CONFIG_SETTINGS=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y

    And, for debugging purposes, can you try to also add this one? Does that change the behavior?

    CONFIG_DFU_TARGET_STREAM_SYNCHRONOUS=y
    Best regards,
    Edvin
  • Hi Edvin,

    I add CONFIG_DFU_TARGET_STREAM_SAVE_PROGRESS in the prj.conf based on example target and light ctrl. I also have added these 

    CONFIG_DFU_TARGET_STREAM_SAVE_PROGRESS=y
    CONFIG_SETTINGS=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    to test before I asked question.

    Best regards,

    John

  • Can you please zip and upload the applications that you are using, together with the build command you are using (even if it is just "west build -b nrf54l15dk/nrf54l15").

    If you are building using VS Code, right click the build configuration, and select "Copy build command" to copy the build command.

    Best regards,

    Edvin

  • This is a modified target example used for testing; The distributor has not been modified. After configuring CONFIG_DFU_TARGET=y, a compilation error occurs due to multiple definitions of dfu_target_init. Since I don't want to modify the original SDK files, I copied dfu_target.c into the project and renamed it to dfu_target_init_.

    Build command: west build --build-dir e:/Nordic/Code/target_330/build e:/Nordic/Code/target_330 --pristine --board nrf54l15dk/nrf54l15/cpuapp -- -DDEBUG_THREAD_INFO=On -DCONFIG_DEBUG_THREAD_INFO=y -Dtarget_330_DEBUG_THREAD_INFO=Off -Dmcuboot_DEBUG_THREAD_INFO=Off

    target_330.rar

    Best regards,

    John

  • I tested both NCS v3.3.0 and v3.2.4, but I am not able to build it using the command:

    west build --build-dir _build --board nrf54l15dk/nrf54l15/cpuapp -- -DDEBUG_THREAD_INFO=On -DCONFIG_DEBUG_THREAD_INFO=y -Dtarget_330_DEBUG_THREAD_INFO=Off -Dmcuboot_DEBUG_THREAD_INFO=Off

    This is the build log:

    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: C:/ncs/toolchains/fd21892d0f/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: C:/nordic/SDKs/ncs/v3.2.4/zephyr/.cache
    -- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp
    Parsing C:/Users/edho/Downloads/target_330/target_330/Kconfig.sysbuild
    Loaded configuration 'C:/Users/edho/Downloads/target_330/target_330/_build/_sysbuild/empty.conf'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/sysbuild.conf'
    Configuration saved to 'C:/Users/edho/Downloads/target_330/target_330/_build/zephyr/.config'
    Kconfig header saved to 'C:/Users/edho/Downloads/target_330/target_330/_build/_sysbuild/autoconf.h'
    -- Sysbuild assigned MCUboot image IDs:
       * Application: 0
    --
       *****************************
       * Running CMake for mcuboot *
       *****************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/nordic/SDKs/ncs/v3.2.4/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/fd21892d0f/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: C:/nordic/SDKs/ncs/v3.2.4/zephyr/.cache
    -- Zephyr version: 4.2.99 (C:/nordic/SDKs/ncs/v3.2.4/zephyr)
    -- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/fd21892d0f/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/nordic/SDKs/ncs/v3.2.4/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts
    -- Found devicetree overlay: C:/Users/edho/Downloads/target_330/target_330/sysbuild/mcuboot/app.overlay
    -- Generated zephyr.dts: C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot/zephyr/zephyr.dts
    -- Generated pickled edt: C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot/zephyr/edt.pickle
    -- Generated devicetree_generated.h: C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot/zephyr/include/generated/zephyr/devicetree_generated.h
    Parsing C:/nordic/SDKs/ncs/v3.2.4/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/nordic/SDKs/ncs/v3.2.4/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/sysbuild/mcuboot/prj.conf'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/sysbuild/mcuboot/socs/nrf54l15_cpuapp.conf'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot/zephyr/.config.sysbuild'
    Configuration saved to 'C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot/zephyr/.config'
    Kconfig header saved to 'C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Found gen_kobject_list: C:/nordic/SDKs/ncs/v3.2.4/zephyr/scripts/build/gen_kobject_list.py
    MCUBoot bootloader key file: C:/nordic/SDKs/ncs/v3.2.4/bootloader/mcuboot/root-ed25519.pem
    CMake Warning at CMakeLists.txt:442 (message):
      WARNING: Using default MCUboot signing key file, this file is for debug use
      only and is not secure!
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/edho/Downloads/target_330/target_330/_build/mcuboot
    --
       ********************************
       * Running CMake for target_330 *
       ********************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/edho/Downloads/target_330/target_330
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/fd21892d0f/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.10") found components: Interpreter
    -- Cache files will be written to: C:/nordic/SDKs/ncs/v3.2.4/zephyr/.cache
    -- Zephyr version: 4.2.99 (C:/nordic/SDKs/ncs/v3.2.4/zephyr)
    -- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
    -- Board: nrf54l15dk, qualifiers: nrf54l15/cpuapp
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/fd21892d0f/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/nordic/SDKs/ncs/v3.2.4/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts
    -- Generated zephyr.dts: C:/Users/edho/Downloads/target_330/target_330/_build/target_330/zephyr/zephyr.dts
    -- Generated pickled edt: C:/Users/edho/Downloads/target_330/target_330/_build/target_330/zephyr/edt.pickle
    -- Generated devicetree_generated.h: C:/Users/edho/Downloads/target_330/target_330/_build/target_330/zephyr/include/generated/zephyr/devicetree_generated.h
    
    C:/Users/edho/Downloads/target_330/target_330/prj.conf:85: warning: attempt to assign the value 'n' to the undefined symbol DFU_TARGET_MODE_DELTAParsing C:/nordic/SDKs/ncs/v3.2.4/zephyr/Kconfig
    Loaded configuration 'C:/nordic/SDKs/ncs/v3.2.4/zephyr/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp_defconfig'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/prj.conf'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/boards/nrf54l15dk_nrf54l15_cpuapp.conf'
    
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/_build/target_330/zephyr/misc/generated/extra_kconfig_options.conf'
    Merged configuration 'C:/Users/edho/Downloads/target_330/target_330/_build/target_330/zephyr/.config.sysbuild'
    
    C:/Users/edho/Downloads/target_330/target_330/prj.conf:86: warning: attempt to assign the value 'n' to the undefined symbol DFU_TARGET_FULL_MODE
    
    error: Aborting due to Kconfig warnings
    
    CMake Error at C:/nordic/SDKs/ncs/v3.2.4/zephyr/cmake/modules/kconfig.cmake:387 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      C:/nordic/SDKs/ncs/v3.2.4/nrf/cmake/modules/kconfig.cmake:112 (include)
      C:/nordic/SDKs/ncs/v3.2.4/zephyr/cmake/modules/zephyr_default.cmake:131 (include)
      C:/nordic/SDKs/ncs/v3.2.4/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/nordic/SDKs/ncs/v3.2.4/zephyr/share/zephyr-package/cma-- Configuring incomplete, errors occurred!
    ke/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:4 (find_package)
    
    
    CMake Error at cmake/modules/sysbuild_extensions.cmake:530 (message):
      CMake configure failed for Zephyr project: target_330
    
      Location: C:/Users/edho/Downloads/target_330/target_330
    Call Stack (most recent call first):
      cmake/modules/sysbuild_images.cmake:43 (ExternalZephyrProject_Cmake)
      cmake/modules/sysbuild_default.cmake:21 (include)
      C:/nordic/SDKs/ncs/v3.2.4/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
      C:/nordic/SDKs/ncs/v3.2.4/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      C:/nordic/SDKs/ncs/v3.2.4/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
      template/CMakeLists.txt:10 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/edho/Downloads/target_330/target_330/_build/CMakeFiles/CMakeOutput.log".
    ←[91mFATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\fd21892d0f\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/fd21892d0f/opt/bin/python.exe '-BC:\Users\edho\Downloads\target_330\target_330\_build' -GNinja -DBOARD=nrf54l15dk/nrf54l15/cpuapp -DDEBUG_THREAD_INFO=On -DCONFIG_DEBUG_THREAD_INFO=y -Dtarget_330_DEBUG_THREAD_INFO=Off -Dmcuboot_DEBUG_THREAD_INFO=Off '-SC:\nordic\SDKs\ncs\v3.2.4\zephyr\share\sysbuild' '-DAPP_DIR:PATH=C:\Users\edho\Downloads\target_330\target_330'
    ←[0

    I do see from the log that the issue is that DFU_TARGET_FULL_MODE is not defined, and I could remove it from prj.conf and retry. But this suggests that we are not testing on the same thing/environment.

    Do you have anything that I can build using an unmodified SDK and toolchain, and reproduce on a DK?

    Also, what do you use to upload the DFU image? Some other device running on a DK? If so, can you please share what you are using here, so that I can actually test it?

    Best regards,

    Edvin

  • So sorry that there is some mistake in the prj.conf. Pls use the new prj.conf and  DFU image as attachment.

    Also you could set a higher version to generate a DFU image,that is  CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION in the prj.conf. Then make a pristine buld and you would get a DFU image in the build folder.

    Mesh_54_v2.0.zip

    1373.prj.conf

    Best regards,

    John

  • Hello John,

    Sorry for the late reply. I have been out of office for a few days. 

    So I can build the application with your new prj.conf.

    Can you please describe how you initialize the DFU process?

    Best regards,

    Edvin

Reply Children
  • What I see when it boots up is:

    **** Booting MCUboot v2.3.0-dev-fce4dac2e629 ***
    *** Using nRF Connect SDK v3.3.0-ba167d9f3db4 ***
    *** Using Zephyr OS v4.3.99-fd9204a02d52 ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: primary slot
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xe000
    I: Image version: v1.0.0
    I: Jumping to the first image slot
    *** Booting Mesh DFU Target v3.3.0-9966ac3adc14 ***
    *** Using nRF Connect SDK v3.3.0-ba167d9f3db4 ***
    *** Using Zephyr OS v4.3.99-fd9204a02d52 ***
    Initializing...
    [00:00:00.018,003] <err> dfu_target: Unknown image type
    [00:00:00.018,853] <inf> fs_zms: 3 Sectors of 4096 bytes
    [00:00:00.018,862] <inf> fs_zms: alloc wra: 0, f60
    [00:00:00.018,868] <inf> fs_zms: data wra: 0, 20
    [00:00:00.018,952] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision                                                                                                                                                                                                                                             :
                                                27 03 7d 53 04 8d fe 99  a9 f2 9a ad                                                                                                                                                                                                                                              de 5b 6a e2 |'.}S.... .....[j.
                                                74 6c ac 75                                                                                                                                                                                                                                                                                   |tl.u
    [00:00:00.020,098] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.020,119] <inf> bt_hci_core: HW Variant: nRF54Lx (0x0005)
    [00:00:00.020,132] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0                                                                                                                                                                                                                                             x00) Version 39.32003 Build 4270654547
    [00:00:00.020,258] <inf> bt_hci_core: No ID address. App must call settings_load                                                                                                                                                                                                                                             ()
    Bluetooth initialized
    [00:00:00.022,386] <inf> bt_hci_core: HCI transport: SDC
    [00:00:00.022,435] <inf> bt_hci_core: Identity: E9:97:DA:36:30:56 (random)
    [00:00:00.022,453] <inf> bt_hci_core: HCI: version 6.2 (0x10) revision 0x30a3, m                                                                                                                                                                                                                                             anufacturer 0x0059
    [00:00:00.022,470] <inf> bt_hci_core: LMP: version 6.2 (0x10) subver 0x30a3
    [00:00:00.026,727] <inf> bt_mesh_provisionee: Device UUID: a0200c8b-f822-45f3-9f                                                                                                                                                                                                                                             df-f37407ddda0c
    Mesh initialized
    [00:00:00.028,747] <dbg> bt_mesh_dfu_srv: bt_mesh_dfu_srv_applied: Wrong state
    *** Booting MCUboot v2.3.0-dev-fce4dac2e629 ***
    *** Using nRF Connect SDK v3.3.0-ba167d9f3db4 ***
    *** Using Zephyr OS v4.3.99-fd9204a02d52 ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: primary slot
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xe000
    I: Image version: v1.0.0
    I: Jumping to the first image slot
    *** Booting Mesh DFU Target v3.3.0-9966ac3adc14 ***
    *** Using nRF Connect SDK v3.3.0-ba167d9f3db4 ***
    *** Using Zephyr OS v4.3.99-fd9204a02d52 ***
    Initializing...
    [00:00:00.019,600] <err> dfu_target: Unknown image type
    [00:00:00.022,260] <inf> fs_zms: 3 Sectors of 4096 bytes
    [00:00:00.022,270] <inf> fs_zms: alloc wra: 0, fc0
    [00:00:00.022,276] <inf> fs_zms: data wra: 0, 0
    [00:00:00.024,199] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
                                                27 03 7d 53 04 8d fe 99  a9 f2 9a ad de 5b 6a e2 |'.}S.... .....[j.
                                                74 6c ac 75                                      |tl.u
    [00:00:00.025,346] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.025,367] <inf> bt_hci_core: HW Variant: nRF54Lx (0x0005)
    [00:00:00.025,380] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 39.32003 Build 4270654547
    [00:00:00.025,506] <inf> bt_hci_core: No ID address. App must call settings_load()
    Bluetooth initialized
    [00:00:00.027,574] <inf> bt_hci_core: HCI transport: SDC
    [00:00:00.027,624] <inf> bt_hci_core: Identity: E9:97:DA:36:30:56 (random)
    [00:00:00.027,642] <inf> bt_hci_core: HCI: version 6.2 (0x10) revision 0x30a3, manufacturer 0x0059
    [00:00:00.027,658] <inf> bt_hci_core: LMP: version 6.2 (0x10) subver 0x30a3
    [00:00:00.037,383] <inf> bt_mesh_provisionee: Device UUID: a0200c8b-f822-45f3-9fdf-f37407ddda0c
    Mesh initialized
    [00:00:00.039,395] <dbg> bt_mesh_dfu_srv: bt_mesh_dfu_srv_applied: Wrong state

Related