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 .

  •   Thank you so much for taking the time to understand my problem. That is really appreciable.

    Looking at the zephyr.dts file present in build/zephyr directory, I could find this code snippet that I have attached. I think this may be how cdc_acm is defined 

    usbd: zephyr_udc0: usbd@36000 {
    				compatible = "nordic,nrf-usbd";
    				reg = < 0x36000 0x1000 >;
    				interrupts = < 0x36 0x1 >;
    				num-bidir-endpoints = < 0x1 >;
    				num-in-endpoints = < 0x7 >;
    				num-out-endpoints = < 0x7 >;
    				num-isoin-endpoints = < 0x1 >;
    				num-isoout-endpoints = < 0x1 >;
    				status = "okay";
    				cdc_acm0: cdc_acm0 {
    					compatible = "zephyr,cdc-acm-uart";
    				};
    				cdc_acm1: cdc_acm1 {
    					compatible = "zephyr,cdc-acm-uart";
    				};
    			};

  • And then we can have a look at where the sample I mentioned sets up cdc_acm:

    zephyr_udc0: &usbd {
    	compatible = "nordic,nrf-usbd";
    	status = "okay";
    
    	cdc_acm_uart: cdc_acm_uart {
    		compatible = "zephyr,cdc-acm-uart";
    	};
    };

    You see how they defined cdc_acm_uart?
    cdc_acm_uart is just the name set in the example. Which name did you give the same type of node in your dts?

  • I'm actually confused now on how to do this. Since I am completely new to this, I actually need some direct hand holding for this. Any chance I can connect with someone directly from the community or with you?

  • I will try to continue to explain a bit further. In your code you got:

    	cdc_acm0: cdc_acm0 {
    		compatible = "zephyr,cdc-acm-uart";
        };

    And the example got:

    	cdc_acm_uart: cdc_acm_uart {
    		compatible = "zephyr,cdc-acm-uart";
    	};

    Your node is named cdc_acm0, and the sample node is named cdc_acm_uart.
    It is the name of the node which you point to in the "chosen" part of the DTS.

    The error message is because you use cdc_acm_uart for your chosen node. But cdc_acm_uart does not exist for your code. Instead the CDC node in your code is named cdc_acm0

    Does that make sense?

  • Yes I now kind of understand what you are saying and I have modified my overlay file accordingly. Please have a look : 

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

    Now the code compiles successfully and I was able to flash it. But the problem still remains the same. I am not able to see the device as a bluetooth controller. But when I check the device list, I can see the 3 ACM ports that are created. Only the default bluetooth controller of my laptop is visible.

Related