Zigbee FOTA update won't apply

Hi,

I am currently developing a custom Zigbee end device with support for FOTA updates. My FOTA seems to work (all data gets transferred correctly) but the update won't apply. The device just restarts and still has the same MCU boot version. For testing FOTA, I am using the Zigbee Light Switch example. Please check my Wireshark capture and see if anything is wrong with the transfer (header, subelement header...). The secur key of the coordinator I am using is: "9d557f5dac6d327963c2d984083b9e7d". 
I am using NRF connect in VS Code with SDK version v2.5.2.

Thanks in advance!

Best Regards,

Pieter-Jan Buntinx

OTA_transfer_capture.pcapng

  • Hi Edvin,

    `CONFIG_MCUBOOT_LOG_LEVEL_INF` does not seem to exist (anymore). I have tried enabling `CONFIG_MCUBOOT_UTIL_LOG_LEVEL_INF` but I don't seem to get the correct output on boot. I have attached my prj.conf file below. 

    82587.prj.conf

  • Hello,

    Edvin is on vacation, so I will look into your issue in the meantime.

    Are you enabling the log by including those configurations inside the prj.config file? If so, that won't work because to configure the mcuboot, you need to include these configurations inside the child_image (child_image\mcuboot.conf) folder. Please refer to the tutorial pointed out by my colleague in his last response.

    Kind regards,

    Abhijith

  • Hi Abhijith,

    I have managed to get the logs. Besides not following the tutorial you mentioned, I could not get them because I was using RTT. Now with the DK board and the serial console, I get the following output after a "successful" OTA:

    *** Booting nRF Connect SDK v2.5.2 ***
    I: Starting bootloader
    I: Primary image: magic=bad, swap_type=0x1, copy_done=0x2, image_ok=0x2
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting nRF Connect SDK v2.5.2 ***
    I: Starting bootloader
    I: Primary image: magic=bad, swap_type=0x1, copy_done=0x2, image_ok=0x2
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting nRF Connect SDK v2.5.2 ***
    I: Starting bootloader
    I: Primary image: magic=bad, swap_type=0x1, copy_done=0x2, image_ok=0x2
    I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Image index: 0, Swap type: test
    I: Starting swap using move algorithm.
    D: erasing trailer; fa_id=2
    D: initializing status; fa_id=2
    D: writing swap_info; fa_id=2 off=0x74fd8 (0x80fd8), swap_type=0x2 image_num=0x0
    D: writing swap_size; fa_id=2 off=0x74fd0 (0x80fd0)
    D: writing magic; fa_id=2 off=0x74ff0 (0x80ff0)
    D: erasing trailer; fa_id=5
    D: writing copy_done; fa_id=2 off=0x74fe0 (0x80fe0)
    I: Bootloader chainload address offset: 0xc000
    �*** Booting nRF Connect SDK v2.5.2 ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xc000
    �*** Booting nRF Connect SDK v2.5.2 ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xc000
    �: Jumping to the first image slot


    After this, the device seems bricked and I am unable to make it work again without reflashing.

    Kind regards,

    Pieter-Jan

  • Hello,

    After reviewing the logs, I suspect the issue might be related to image signing. Have you followed all the steps mentioned on this page? Ensure that the firmware image being sent over OTA is correctly signed and validated before the update process.

    Kind regards,

    Abhijith

  • Maybe something dumb I am doing wrong but I cannot get it building when adding a key_file. 

    I have added: CONFIG_MCUBOOT_SIGNATURE_KEY_FILE=" C:/ncs/v2.5.2/bootloader/mcuboot/root-rsa-2048.pem"
    To my prj.conf file, I have also tried using the commands of the page you mentioned. I have also tried generating a key myself using this guide. But I always get the following error:

    C:/{BUILD_DIR}/build_DK/zephyr/misc/generated/extra_kconfig_options.conf:3: warning: malformed string literal in assignment to MCUBOOT_SIGNATURE_KEY_FILE (defined at modules/Kconfig.mcuboot:50). Assignment ignored.

    Below you can find the contents of the priv key I generated myself: 

    -----BEGIN PRIVATE KEY-----
    MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgrdvjY9/wxIV/hq3D
    XlJGlSttPs/BkyXwoQWgCVX104ahRANCAAQLC+VA9lpwSOaByahZZsGSbZqueIfI
    5TXLxJ20S1z2Am7MrhiPeN9iFMUp4Iut6zYVdyTs+WukencDHlUMXhXI
    -----END PRIVATE KEY-----

Related