How to modify an app to be updated and update from it with MCUBoot.

I need to upgrade firmware with MCUBoot (buttonless). I have read these tutorials:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html#smp-svr-sample-build

https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu#modify_hello_world

I have a nrf52840dk and working with ncs v2.2.0 and my limitation is that I have to use the J3 USB connector.

If I follow the steps provided in the first tutorial (SMP_Server), I can build the sample with the next command:

I can acces to mcumgr through J3 usb connector:

So now I can go to the second tutorial I provided. There I can see how to modify a sample to be uploaded to the board. I just have to add to the prj.conf:

And add in the main the next code:

So now I can compile a blinky sample with that modification and I can upgrade my board with the blinky sample. The problem is that once the board is updated, the J3 usb connector is not available anymore.

I decided to modify the blinky sample to be FLASHED and that the J3 usb port is available. So the first step was include in the building command the same overlay-cdc.conf and usb.overlay that are included in the SMP_Server sample. 

I modified the main.c file too, because in the last post of this thread tell that the USB has to be initialized, including:

And obviously the prj.conf is modified too:

When I build and flash into my DK board I can see the J3 port available (ls /dev/tty*), but mcumgr is nos responding. What more should I add from the SMP_Server sample to my blinky project to enable mcumgr?

I attach the project in the case you want to check something:

3010.blinky.zip

  • Resolved!

    I have to add this to the "nrf52840dk_nrf52840.overlay":

    The main.c would be:

    And the prj.conf:

    Now it works!