USB Firmware updates and serial communication over the same port

I have a 7002dk dev kit. Currently for evaluating the nrf5340, which will be used in my product.

Currently i am trying to evaluate if it is possible to use the nRF5340 USB port for both Firmware updates, be it via DFU, or Serial Recovery( via usb-cdc-acm), as well as serial output for logging/communication with my Desktop app. Right now I don't care which way to go, but I need to know if I can enable both.

For testing i got both these 2 examples working:
Nordic Academy Chapter 9.4 https://github.com/NordicDeveloperAcademy/ncs-inter/tree/main/v2.9.0-v2.7.0/l9/l9_e4_sol for serial cdc acm using AuTerm,
as well as: This USB-DFU example using dfu-util:
https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/subsys/usb/dfu

So right now i don't have a working example for either of those 2 where i can still use normal usb communication, or even serial communication via usb with my device.

How could i add this functionality into either of those 2 examples? (I prefer the first, as this has already mcuboot included)

Parents
  • Hello,

    I believe it's possible to enable serial output for logging over USB. If you're using the Developer Academy sample, it already utilizes the USB CDC ACM interface. In that case, you'll need to add the logging backend to the CDC ACM interface.

    To display logs over USB CDC ACM, you can include the following code in the app.overlay file:

    / {
        chosen {
            zephyr,console = &cdc_acm_uart0;
            zephyr,uart-mcumgr = &cdc_acm_uart0;
        };
    };
                                       
     #already inside the sample
    &zephyr_udc0 {                           
        cdc_acm_uart0: cdc_acm_uart0 {
            compatible = "zephyr,cdc-acm-uart";
        };
    };
    

    Also, make sure to enable the necessary configuration options for logging, such as:

    CONFIG_LOG_BACKEND_UART=y     
    CONFIG_LOG=y   
    
    CONFIG_UART_CONSOLE=y # CDC ACM as UART console
    CONFIG_USB_CDC_ACM=y

    Kind Regards,

    Abhijith

Reply
  • Hello,

    I believe it's possible to enable serial output for logging over USB. If you're using the Developer Academy sample, it already utilizes the USB CDC ACM interface. In that case, you'll need to add the logging backend to the CDC ACM interface.

    To display logs over USB CDC ACM, you can include the following code in the app.overlay file:

    / {
        chosen {
            zephyr,console = &cdc_acm_uart0;
            zephyr,uart-mcumgr = &cdc_acm_uart0;
        };
    };
                                       
     #already inside the sample
    &zephyr_udc0 {                           
        cdc_acm_uart0: cdc_acm_uart0 {
            compatible = "zephyr,cdc-acm-uart";
        };
    };
    

    Also, make sure to enable the necessary configuration options for logging, such as:

    CONFIG_LOG_BACKEND_UART=y     
    CONFIG_LOG=y   
    
    CONFIG_UART_CONSOLE=y # CDC ACM as UART console
    CONFIG_USB_CDC_ACM=y

    Kind Regards,

    Abhijith

Children
No Data
Related