This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Build CLI sample in nRF_connect_sdk for nrf52840 dongle

Hi,

When I build CLI sample in nRF_Connect_SDK, I don't get any USB port for CLI.

I believe the sample is in default mode built for UART.

How to build this for USB, so that I can run my CLI on USB port for nrf52840_dongle.

  • Hi,

    You can make the sample use USB by activating the USB overlay extension:

    • Set OVERLAY_CONFIG to overlay-usb.conf
    • Set DTC_OVERLAY_FILE to usb.overlay

    For how to add this option see Providing CMake options. See Important Build System Variables for more information about configuration overlay files.

    Best regards,

    Marte

  • Hi,

    can you provide an example where CLI is built for nrf52840 dongle in USB mode? 

  • Hi,

    You have multiple options for setting the overlay files to enable the extension.

    One option is to set it in CMakeLists.txt by adding the following lines before find_package:

    set(OVERLAY_CONFIG  "${CMAKE_CURRENT_SOURCE_DIR}/overlay-usb.conf")
    set(DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/usb.overlay")

    You can also set it in the IDE if you are using VS Code or SES, or you can add it as an argument if you build on the command line. All of these options are explained here: Configuring build types.

    Then you just need to build the sample to make the extension be enabled.

    Best regards,

    Marte

  • I have build the cli example for nrf52840 dongle using following command:

    "west build -b nrf52840dongle_nrf52840 -d build_nrf52840dongle_nrf52840 -- -DCONF_FILE=overlay-usb.conf -DDTC_OVERLAY_FILE=usb.overlay"

    and build was successful.

    Now I flashed the code in my nrf52840 dongle using "west flash" command. It was successfully flashed as well.

    But when I connect my dongle on. my laptop, on USB port, I can't see any dev/tty* port corresponding to dongle.

    How should I access cli screen on nrf52840 dongle?

  • Hi,

    The file overlay-usb.conf should be passed as OVERLAY_CONFIG, not CONF_FILE. Please try the following command instead:

    west build -b nrf52840dongle_nrf52840 -d build_nrf52840dongle_nrf52840 -- -DOVERLAY_CONFIG=overlay-usb.conf -DDTC_OVERLAY_FILE=usb.overlay

    Bhumika said:
    Now I flashed the code in my nrf52840 dongle using "west flash" command

    Are you using an external debug probe to flash the dongle, since you are able to do so using west flash?

    Best regards,

    Marte

Related