nRF5 SDK v16.0.0
USB CDC ACM Example
This information applies to the nRF52840 SoC only.

This example uses the USB CDC ACM module. See the documentation of this module for links to relevant specification documents.

This example shows how to use the CDC ACM USB class, commonly known as Virtual COM port. After connecting the USB cable, the development kit will enumerate as a COMx port on Windows hosts or as a /dev/ttyACMx device on Linux/Unix hosts. The port can be opened and closed just like a traditional serial port.

Windows 8 (and later) hosts will pick the correct driver (usbser.sys) automatically.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\usbd_cdc_acm

LED assignments:

Button assignments:

Testing

Test the USB CDC ACM Example application by performing the following steps:

  1. Compile and program the application.
  2. Connect the development kit to the host computer through the J-Link port.
  3. Connect the nRF USB to the host computer.
  4. If you are running Windows 7, on first run CDC ACM driver installation is needed. To install the driver on Windows 7, follow these steps:
    • Open Device Manager
    • Right-click the development kit (look for the name "nRF52 ..." depending on the example)
    • Click "Update Driver Software..."
    • Click "Browse my computer for driver software"
    • Click "Browse..." and choose the folder sdk/nrf5/examples/usb_drivers
    • Click "Ok"
    • Click "Next"
    • Click "Install"
    • Click "Close"
  5. Open the serial port. In your computer's device manager, the development kit will be visible as "nRF52 USB CDC Demo (COMx)".
  6. Using a terminal emulator, for example PuTTY with the following Terminal settings, send test data from the host computer to the development kit. LED 3 will blink.
  7. Press Button 1. A test frame will be sent from the development kit. LED 4 state will change. If you are using a terminal emulator, you can see the transmitted data on it as well.

Documentation feedback | Developer Zone | Subscribe | Updated