nRF5340 DFU both cores with external flash

My current project is using nRF5340, NCS 2.3.0, nRF5340-DK hardware, and development environment is VS code in Windows. At present I'm struggling to get DFU working to update both the app and net cores.

I think that what's happening now is this: the dfu_application.zip is uploaded to the DK board from mobile phone over BLE, is written somewhere (how can I verify that it went to exernal flash?), and the app core firmware is updated. Then the board gets stuck in a reboot loop in mcuboot. I believe it is attempting to update the firmware for the net core and failing, then retrying endlessly.

I discovered that I can break the reboot loop by running nrfjprog --qspieraseall. A manual reset after this step brings the board back up into a functional state. Based on a time stamp in a printk the app core updated but the net core is running its original firmware.

Help getting the DFU working to update firmware for both cores will be much appreciated!

0753.hci_rpmsg.conf0257.mcuboot.confmcuboot.overlaydts.overlay4061.prj.conf

Parents Reply Children
  • Yes, I have run into some trouble. I added items that were in my .conf files into yours until finally the upgrade broke. Then I began undoing my changes out of your sample. Finally I arrived at the base sample again -- in fact, I used git restore to ensure this -- but still the sample no longer works.

    After I upload the dfu_application.zip via BLE I see the following messages from mcuboot in the app core serial port:

    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    AAA this to see it change.
    Bluetooth initialized
    Advertising successfully started
    I: Starting bootloader
    I: Swap type: perm
    I: Swap type: perm
    I: Image upgrade secondary slot -> primary slot
    I: Erasing the primary slot
    I: Copying the secondary slot to the primary slot: 0x1cbb8 bytes
    I: Image upgrade secondary slot -> primary slot
    I: Erasing the primary slot
    I: Copying the secondary slot to the primary slot: 0x2e040 bytes
    I: Starting bootloader
    I: Swap type: none
    I: Swap type: perm
    I: Image upgrade secondary slot -> primary slot
    I: Erasing the primary slot
    I: Copying the secondary slot to the primary slot: 0x2e040 bytes
    I: Starting bootloader
    I: Swap type: none
    I: Swap type: perm
    I: Image upgrade secondary slot -> primary slot
    I: Erasing the primary slot
    I: Copying the secondary slot to the primary slot: 0x2e040 bytes

    As you can see, the app core image updates but the net core image is incomplete. The 0x2e040-size image is repeatedly copied to the primary slot but it does not progress further.

    Earlier, when your sample was working for me, I noticed that after the first time copying the 0x2e040-size image a message printed like "Net core turning on" or similar. That message is not printing now.

    This looping of copying the 0x2e040-size image continues even if I reset the board or re-flash the board. As described in my first post, I found I could stop this by erasing the QSPI flash with nrfjprog.

    There must be something causing your sample to not work now, but I haven't been able to identify what it could be. Like I said, I've reset the code to its state from your repo. Also I've deleted my build directory, re-started VS code.. I'm running out of ideas!

  • caeg said:
    Finally I arrived at the base sample again -- in fact, I used git restore to ensure this -- but still the sample no longer works.

    This is odd indeed. Since the sample worked before, something is wrong here, and I think it is a good idea to figure out what that is before we go on.

    caeg said:
    There must be something causing your sample to not work now, but I haven't been able to identify what it could be. Like I said, I've reset the code to its state from your repo. Also I've deleted my build directory, re-started VS code.. I'm running out of ideas!

    These are the things I would suggest:

    • Delete build directory
    • flash with erase all
    • erase qspi
    • re-start VS Code
    • Reset repo

    Then one step which you have not mentioned:

    • Check that you have no changes to the nRF Connect SDK
      • This can be done by doing "git status" from inside the different git folders. The relevant folders here would be nrf, zephyr and bootloader/mcuboot.
      • Changing nRF Connect SDK versjon should also make sure that no changes are made to it.

    Also:

    Do you see the same issue if you update only the application core with app_update.bin?
    Same for net_core_app_update.bin, do you see the issue?

    Or is it only if you update both?

    Which changes have you done to the project in the update file you send?

Related