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.
Parents
  • Hi,

    I assume you are using the nRF5 SDK as you are using nrfutil for this?

    Are you using nrfutil from here? That is the only currently supported version. And to update it you use "nrfutil self-upgrade" and subsequently "nrfutil pgrade" to install various commands. Note that you must install nrf5sdk-tools in order to perform nRF5 SDK DFU. If this still fails, can you show the the command you use and the log with the error?

    Regarding the specific questions, we do not have any guidance on automated FOTA testing. nrfutil is the only command line tool we provide for nRF5 SDK secure DFU, so it makes sense to call that from your python test scripts.

  • ok I installed nrfutil.  My code snip, 

      cmd = f"nrfutil dfu ble -ic NRF52 -f {firmware_file} -a {mac_address} --timeout 600"
     
                   result = subprocess.run(cmd, shell=True, capture_output=True, text=True)

          if result.returncode == 0:
                print(f"[SUCCESS] FOTA update sent to {mac_address}")
      
    output prints as SUCCESS but the device is not actually flashed. 
    since I am using the nrf52 SDK , I zipped all the bin and hex files from path  src\build\zephyr  and used a firmware_file here.
    Please let me know why the flashing didnt take place. 
Reply
  • ok I installed nrfutil.  My code snip, 

      cmd = f"nrfutil dfu ble -ic NRF52 -f {firmware_file} -a {mac_address} --timeout 600"
     
                   result = subprocess.run(cmd, shell=True, capture_output=True, text=True)

          if result.returncode == 0:
                print(f"[SUCCESS] FOTA update sent to {mac_address}")
      
    output prints as SUCCESS but the device is not actually flashed. 
    since I am using the nrf52 SDK , I zipped all the bin and hex files from path  src\build\zephyr  and used a firmware_file here.
    Please let me know why the flashing didnt take place. 
Children
  • Hi,

    I am a bit confused here. Y ou write nRF52 SDK, which I would assume point to the nRF5 SDK. But you write src\build\zephyr. If that is the case, you can use mcumgr on a Linux computer do perform DFU over the air. (The nrfutil dfu command is only relevant for the old nRF5 SDK bootloaer)

  • Actually I need to work on windows computer and found that nrfutil was the alternative way to use . Yes its a v2.7.0  nRF5 SDK. Is there a trusted library for mcumgr for windows something  like this page www.nordicsemi.com/.../ 

  • I see. But if you are using the nRF Connect SDK (as it seems), nrfutil is the only solution I am aware of, and that only works with Bluetooth on Linux.

  • 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.

Related