Automating FOTA Flashing for 20 boards of nRF52840 DK using BLE

I am working on automating the FOTA flashing process for 50 PCA10056 (nRF52840 DK) boards using a Python script. The goal is to efficiently flash firmware onto multiple boards simultaneously while ensuring reliability.

I have already tried using nrfutil, but I encounter the same error as described in Case ID: 256309. Additionally, mcumgr has never worked for me.

I would like guidance on:

  1. Best practices for automating FOTA updates on multiple nRF52840 DKs.
  2. Recommended tools and libraries (nrfutil,or other alternatives).
  3. The best command to use for this operation.
  4. Handling potential issues such as connection stability and flashing failures.
  5. Any existing scripts or references that could help streamline this process.
  • I need a command line solution for my python scripts as I work with many nodes. nRF Connect SDK is a GUI/App. which doesn't match my requirement. Can you please help me to flash with nrfutil? I am using the evaluation kit  nRF52840 DK. Is there any prerequisite like going into DFU mode with button press? I  understood that command " nrfutil dfu ble..." is a SW way to put into the DFU mode. Manual  button press didn't work. 

  • Hi,

    PGenius said:
    Can you please help me to flash with nrfutil?

    You can use nrfutil to flash via a debugger (the DK has an onboard debugger so if it is connected to the computer that will work out of the box with "nrfutil device", see "nrfutil device --help"), but as it seems you are using nRF Connect SDK (please confirm), that cannot be used to perform DFU over Bluetooth.

    PGenius said:
    Is there any prerequisite like going into DFU mode with button press?

    Normally not. Assuming you are using the nRF Connect SDK and do DFU over BLE, the transport happens in the application, and if you use for instance the SMP server sample, this should work out of the box (but not with nrfutil).

    I am a bit confused about this thread, so if you can back-track a bit and describe in more detail both which SDK you are using, and other details about your firmware that would help.

  • Hi Einar,

    This is my understanding. 

    • Non-Zephyr Project (nrf5 SDK maintenance mode ): Uses Nordic Secure Bootloader and works with nrfUtil for firmware updates.

    • Zephyr Project (nrf Connect SDK - NCS): Uses MCUBoot (if configured) and works with MCUmgr for firmware updates

    To be precise, I am using windows platform, NCS  and want to perform FOTA with BLE, Is MCUmgr only the possibility? 

    I was unsuccessful with FOTA Flashing  with configuration in NCS, 

    CONFIG_BT_PERIPHERAL=y

    CONFIG_BOOTLOADER_MCUBOOT=y

    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    when i tested with 
    cmd = f"nrfutil dfu ble --conn-ic NRF52 -pkg {firmware_file} --timeout 3000"
    I am right now blocked if i am on a right track or should I use MCUmgr library or does Nordic support any other libraries ? I am still unclear with  this SMP sample 
  • Hi,

    PGenius said:
    To be precise, I am using windows platform, NCS  and want to perform FOTA with BLE, Is MCUmgr only the possibility? 

    For PC side, mcumgr is the only possibility (in the sense that we are not developing an alternative, but it is possible to develop this yourself if needed). mcumgr does not work with Bluetooth on Windows, so we do not currently provide any solution for that from the command line.

    PGenius said:
    I am right now blocked if i am on a right track or should I use MCUmgr library or does Nordic support any other libraries ? I am still unclear with  this SMP sample 

    You are not on the right track, as you cannot perform DFU for nRF Connect (MCUboot) via nrfutil.

    One suggestion is to use a Linux computer for your automated testing, and use mcumgr via the command lien there. Another is to do manual testinf of DFU. The third is to develop your own solution.

  • Hi Einar,

    I have installed Linux on my raspberry pi and also mcumgr command installation successfully . I see that all the steps works fine until I confirm the image . I get error 3 for "image confirm" cmd. Due to this my flashed SW is not permanent. I have changed the device name as well. 

    I use nRF Connect SDK Toolchain v2.7.0

    1) I have added these below changes in proj_conf; 

    CONFIG_BOOTLOADER_MCUBOOT=y

    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    2)

    new image is now swapped from slot 1 to slot 0, user@raspberrypi:~ $ sudo mcumgr --conntype ble --connstring 'peer_name=Zephyrtest' image list

    Images:

     image=0 slot=0

        version: 2.6.0

        bootable: true

        flags: active

        hash: 45e6a61863cc78237c8467359fed716e611a346cede52c0df087ec67718472c7

     image=0 slot=1

        version: 2.6.0

        bootable: true

        flags: confirmed

        hash: 8e30aa3cffb62bcf8a05cfb199505bb97843ccab8a5bc99abd97f0c132d2a052

    Split status: N/A (0)

    user@raspberrypi:~ $ 

    sudo mcumgr --conntype ble --connstring 'peer_name=hoetest' image confirm

    Error: 3


    sudo mcumgr --conntype ble --connstring 'peer_name=hoetest' image confirm
    Error: 3

Related