Can SWO be used to output logs ? And is it more efficient in terms of memory and power consumption compared to using USB?

SDK: nRF Connect SDK 2.9.0 with VS Code 

SoC: nRF52840. nRF52840-DK for development. 

We are currently using USB to output logs for debugging. For production, we disable the logs over USB from prj.conf. The test firmware has a larger size and consumes more power compared to production firmware. 

Is it possible to use SWO to output logs? If yes, are there any references which we can follow to implement the same? Also, will it lead to reduced power consumption and smaller size of build files, as compared to using USB for logs?   

Parents
  • Hi,

     

    Using the logger with a simpler backend, for instance uart or rtt, should reduce the space required as compared to using usb cdc as the logger.

    Try something like this:

    # RTT backends
    CONFIG_RTT_CONSOLE=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    
    # UART backends
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG_BACKEND_UART=n

     

    If you still see high code size, you could add "CONFIG_LOG_MODE_MINIMAL=y" as well.

     

    Kind regards,

    Håkon

  • Thank you for your answer  . 

    However, RTT backend or UART will work on the nRF52840DK. On the custom hardware designed around nRF52840, I want to understand if we can use SWO to output logs? If yes, I am trying to find implementation examples or reference guides - on enabling it and monitoring it using VS Code / terminal. 

Reply Children
Related