Enable mcumgr features on NRF5340 DK board while Bluetooth HCI_USB program is running

Hello community,

I am trying for multiple firmware updates for my NRF5340 DK board. 

What I am doing is I have build and flashed the SMP server sample program found /zephyr/samples/subsys/mgmt/mcumgr/smp_svr

After flashing this application, I can see my board recognised as a ttyACM0 device while I perform ls /dev.

Using the mcumgr tool I am also able to flash the Bluetooth HCI_USB sample program and after confirming the image and resetting the board, the board now acts as a bluetooth controller. I can verify this using the bluetoothctl command.

Now If I want to do a firmware upgrade, I dont have any way in the HCI_USB application to go back to smp server application. How can I perform multiple firmware updates using mcumgr?

Can virtual com port concept be useful here? If yes then I would like to have a detailed tutorial for this .

  •   since the dts file is created while building the project, any changes I make to this file will again be replaced once I rebuild the code

  • / {
    	chosen {
    	   zephyr,code-partition = &slot0_partition;
    	   zephyr,out-usb = &cdc_acm1;
    	   zephyr,uart-mcumgr = &cdc_acm0;
    	   zephyr,bt-mon-uart = &cdc_acm_uart;
    	   zephyr,bt-c2h-uart = &cdc_acm_uart;
    	};
     };
    
    &zephyr_udc0 {
    	cdc_acm0: cdc_acm0 {
    		compatible = "zephyr,cdc-acm-uart";
    	};
    	cdc_acm1: cdc_acm1 {
    		compatible = "zephyr,cdc-acm-uart";
    	};
    };
    
    &uart0 {
    	status = "okay";
    };

      I tried this modification in my overlay file but now the code does not compile. I have attached the overlay file contents.

  • Utsav R Shah said:
    but now the code does not compile.

    What is the error message?

  • west build -b nrf5340dk_nrf5340_cpuapp -- -DOVERLAY_CONFIG=overlay-cdc.conf -DDTC_OVERLAY_FILE=bl5340_dvk_cpuapp.overlay -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"/home/mutsl04176/ncs/v2.4.2/bootloader/mcuboot/root-rsa-2048.pem\"
    
    
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: /home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb
    -- CMake version: 3.27.7
    -- Using NCS Toolchain 2.5.20231017.513615545433 for building. (/home/mutsl04176/ncs/toolchains/7795df4459/cmake)
    -- Found Python3: /home/mutsl04176/ncs/toolchains/7795df4459/usr/local/bin/python3 (found suitable exact version "3.8.2") found components: Interpreter 
    -- Cache files will be written to: /home/mutsl04176/.cache/zephyr
    -- Zephyr version: 3.3.99 (/home/mutsl04176/ncs/v2.4.2/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.7.1")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Found host-tools: zephyr 0.16.1 (/home/mutsl04176/ncs/toolchains/7795df4459/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (/home/mutsl04176/ncs/toolchains/7795df4459/opt/zephyr-sdk)
    -- Found BOARD.dts: /home/mutsl04176/ncs/v2.4.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: bl5340_dvk_cpuapp.overlay
    devicetree error: /chosen: undefined node label 'cdc_acm_uart'
    -- In: /home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb/build/zephyr, command: /home/mutsl04176/ncs/toolchains/7795df4459/usr/local/bin/python3;/home/mutsl04176/ncs/v2.4.2/zephyr/scripts/dts/gen_defines.py;--dts;/home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb/build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;/home/mutsl04176/ncs/v2.4.2/nrf/dts/bindings;/home/mutsl04176/ncs/v2.4.2/zephyr/dts/bindings;--header-out;/home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb/build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;/home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb/build/zephyr/zephyr.dts.new;--edt-pickle-out;/home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb/build/zephyr/edt.pickle;--vendor-prefixes;/home/mutsl04176/ncs/v2.4.2/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;/home/mutsl04176/ncs/v2.4.2/zephyr/dts/bindings/vendor-prefixes.txt
    CMake Error at /home/mutsl04176/ncs/v2.4.2/zephyr/cmake/modules/dts.cmake:276 (message):
      gen_defines.py failed with return code: 1
    Call Stack (most recent call first):
      /home/mutsl04176/ncs/v2.4.2/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
      /home/mutsl04176/ncs/v2.4.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      /home/mutsl04176/ncs/v2.4.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
      CMakeLists.txt:4 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /home/mutsl04176/.local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb/build -GNinja -DOVERLAY_CONFIG=overlay-cdc.conf -DDTC_OVERLAY_FILE=bl5340_dvk_cpuapp.overlay '-DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE="/home/mutsl04176/ncs/v2.4.2/bootloader/mcuboot/root-rsa-2048.pem"' -S/home/mutsl04176/ncs/v2.4.2/zephyr/samples/bluetooth/hci_usb

Related