DFU OTA NCS 2.4.0 Tutorial and Docs

Hi. I was trying to integrate the DFU OTA in my project and after a lot of struggle I made it work.

It seems all the FOTA examples and tutorials are outdated and don't work with NCS 2.4.0. All the information I found seems full of inconsistencies and now I'm concerned about moving forward/finding information about new features. Is it safer to use and older version of NCS? Or I'm just missing the right way of doing things/using the docs?

Here is a summary of what I tried and the problems I found:

1) Started reading this: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/bootloaders_and_dfu/fw_update.html
- Ok, this looks complex and full of moving parts so let's try to find an example to start with.

2) Found this tutorial: https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu
- The project provided here just doesn't work with NCS 2.4.0 and there's no mention to that.
- There are outdated kconfig options, wrong headers and functions that are not used directly when you're working with NCS 2.4.0
- But still, recent posts suggest this broken tutorial as a source of info: https://devzone.nordicsemi.com/f/nordic-q-a/101555/dfu-over-the-air-upgrades/437116

3) Finally, found this https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/device_guides/working_with_nrf/nrf52/developing.html and
discovered a magic config (CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU) that enables a bunch of other configs and let me compile the code. I'm still trying
to find all the configs this thing enables (is there a documentation explaining that?)

4) Now with the sample working, I try to add the OTA to my project. SMP service doesn't show up (not sure why as I've changed so many configs trying to make it work...).
- Found the SMP example. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html
- One more project that doesn't compile right out of the box with NCS 2.4.0. More digging time.

5) Managed to make the SMP service to show up and can use the FOTA for the 1st time!

6) Notice the MCUboot is using the default encryption keys. Need to add my own. Go into another rabbit hole:
- https://devzone.nordicsemi.com/f/nordic-q-a/86064/mcuboot-with-custom-key/359463
- https://devzone.nordicsemi.com/f/nordic-q-a/86668/mcuboot-private-key-on-nrf5340dk (Here I found more configs that are not mentioned in the examples/tutorial)
- Mention to another project that doesn't compile out of the box and doesnt include needed MCUBoot overlay config file: https://devzone.nordicsemi.com/f/nordic-q-a/102296/warning-using-default-mcuboot-key-it-should-not-be-used-for-production
- Suggestions of lots of CMake Hacks: https://devzone.nordicsemi.com/f/nordic-q-a/88914/mcuboot-signature-key-file-with-ncs-v2-0-0

7) Finally found the missing "child_image" directory. Adding that makes evertyhing work.
- Why this directory is not created automatically? We're already buried in hundreds of building tools and configurations anyways...

Am I doing something wrong?

Thanks.

Parents
  • Hello,

    Recently, Zephyr v3.3 has been updated, and they have standardised some of their Kconfig names. See the release notes for more details.

    I am attaching a simple mcuboot_smp sample doing DFU over BLE as a reference. I tested this sample under NCS v2.4.0. Please check the prj:conf file to see how the names got changed.

    Whenever you enable the MCUboot, it will be running as another application, but for configuring this application, the easiest method is to create a child_image folder inside your main application and include your custom configuration in the child_image folder.

    For generating the custom key and signing, I recommend you follow this repository from my colleague. I am not sure whether he tested this under NCS v2.4.0, but refer to the method for generating the key.

    Kind Regards,

    Abhijith

    mcuboot_smp_ble.zip

Reply
  • Hello,

    Recently, Zephyr v3.3 has been updated, and they have standardised some of their Kconfig names. See the release notes for more details.

    I am attaching a simple mcuboot_smp sample doing DFU over BLE as a reference. I tested this sample under NCS v2.4.0. Please check the prj:conf file to see how the names got changed.

    Whenever you enable the MCUboot, it will be running as another application, but for configuring this application, the easiest method is to create a child_image folder inside your main application and include your custom configuration in the child_image folder.

    For generating the custom key and signing, I recommend you follow this repository from my colleague. I am not sure whether he tested this under NCS v2.4.0, but refer to the method for generating the key.

    Kind Regards,

    Abhijith

    mcuboot_smp_ble.zip

Children
No Data
Related