Enabling multiple firmware/application updates on NRF5340 DK board using DFU feature

,

Hello community,
I am following the below process to rollout an device firmware update from mender dashboard using DFU approach.

I am trying to do an application / firmware update to the NEF5340 DK board using the DFU application

Here are the steps that I am following:

  1. First, I compile the DFU sample program given at zephyr/samples/subsys/usb/dfu.

The program compiles and then I flash the app_update.bin file generated in /build/zephyr directory onto the NRF5340DK board.

Now I build the hci_usb application present at /zephyr/samples/bluetooth/hci_usb.

What I did here is I copied the contents of the prj.conf file of the usb dfu application to the prj.conf file of the hci_usb application :

In the above image you can see I have added the USB DFU application flags in the config files of the hic_usb application. I then build the hci_usb application.

After building the application I get the app_update.bin file in /build/zephyr folder.

I now flash this this app_update.bin file using the dfu-util and it is successful. Yo can see the screenshot below:

Since I have enabled the USB DFU config flags in HCI_USB program as well. I can still see the device in the list of USB devices connected with the custom name that I have given. Check the screenshot below:

Now when I try to upload any firmware file using dfu-util I get the following error “cannot claim interface 1

Essentially what I want to do is have the ability to upload another firmware using DFU when an existing firmware is running. How do I automatically bring the board back to DFU mode when an application is already running? I don’t want to reset the board manually to bring it to DFU again.

Let’s say a I flashed a blink program using dfu-util application. Now while the blink program runs, I dont have a way to get back to DFU mode if I need to flash another firmware again. How do I do this automatically? Do I need to make any changes in the MCUboot bootloader?

@TheYoctoJester I was wondering how do you deploy multiple firmware upgrades using this method. As an example let’s say I create a mender artefact for program A and deploy it- it successfully flashes on to my NRF5340 DK board and starts executing. Now when this program is executing, I don’t have a way to make the device go back to DFU mode. If the device doesn’t go to DFU mode when I deploy the artefact, then it fails. So how do I trigger my board to come to DFU mode before deploying the artefact?

Hi @Utsav_Shah,

I am not familiar with the NRF5340 particularly, so I can not give detailed steps. In general, the procedures to get a board into DFU loader mode vary - a short google research indicates that you need to push a button. Obviously, this is not something that a Mender Update Module can do. Moreso, the mcuboot loader also won’t do the trick: once the application is running, it doesn’t have any effect anymore.
So generally, it works like this:

  • have a way to reset the MCU from the main system, like triggering the reset line from a GPIO
  • have a way to initiate DFU mode from the main system, like a second GPIO
  • during Artifact installation in your custom module, set the GPIOs accordingly to reach the required state

Again, your board and setup might have or need other means. This is something that your R&D team needs to look into, software mechanisms can’t do magic.

Greetz,
Josef