This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF5340 - DFU over serial mission impossible

Hi,

My system is
  - nRF5340 custom board
  - Zephyr OS build v2.3.0-rc1-ncs1
  - nRF-Connect-SDK v1.2.0
To perform DFU over UART I was told to merge MCUBoot + mcumgr + smp_srv along with my application (MyApp).
Moving some config switches allowed me to
a) Build and program mcuboot in bootloader partition (using nrjprog over SWD)
b) Build and program MyApp (or smp_srv) in slot-0 (using nrjprog over SWD)
c) Build and DFU upload MyApp in slot-1 (using mcumgr over UART)
d) Confirm slot-1 image (using mcumgr over UART)
To finish the job I have to re-initiate DFU from within MyApp, passing control to smp_srv again, otherwise all this stuff makes no sense, really.
Is there an engineer from Nordic who knows how to do it ?
Best Regards
  • I'm happy to help and that you found a working solution Slight smile

  • Hi,Gabriele,

          My understanding is that your application normally running in "MyApp" , and the step "On next reboot the flag state is read (to set the current mode of operation) and then immediately cleared in flash (for next reboot)." also done on "MyApp", So after erased the flash, how do you step into dfu mode??? I also checked your another ticket, you mentioned these two APIs:

    int boot_set_pending(int permanent);
    int boot_set_confirmed(void);

        Did you finally use the APIs to step into DFU mode??

        Or your application always step into "MyApp", but by checking a flag on "MyApp" to decide the different operations??

         I also met some issues about DFU on nrf5340, Looking forward to your reply.

    BR

    Smile

  • Hello Smile

    I didn't use the API you are mentioning.
    You have to rebuild the MyApp with mcuboot and smp-srv child applications.
    Take a look of image, a shrinked version of MyApp, just to make you figuring out.
    In the first part of MyApp you retrieve the flag stored in the LittleFS.
    Thereafter you check the flag to switch either to the application loop or to DFU related MCUMgr APIs.
    If you run through a DFU (dfumode=1), you will erase the Flash (slot-1), write the new image (slot-1) and swap (slot-0 <- slot-1).
    But the LittleFS's content is not touched by that, because it is safely stored on a different partition of the Flash (see memory map)

    Hope this helps.

    Gabriele

Related