nRF5 SDK  v12.3.0
Choose documentation:
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
USB CDC ACM module
This information applies to the nRF52840 SoC only.

This module covers basic implementation of the USB Communications Device Class (CDC) Abstract Control Model (ACM). The class has been defined in the following specification documents:

Abstract Control Model (ACM) is in fact a subclass of the Communications Device Class (CDC).

Interfaces

The ACM subclass describes the bidirectional communication flow popularly known as Virtual Serial Port. The class has two interfaces:

  • COMM interface that contains one IN endpoint. The COMM interface is used to notify the host about serial state. Notifications can be sent by app_usbd_cdc_acm_serial_state_notify API call.
  • DATA interface that contains one IN and one OUT bulk endpoint. The DATA interface allows to send or receive bulk data.

Sending and receiving data

Sending of data is performed by the app_usbd_cdc_acm_write function. When all data is sent, event APP_USBD_CDC_ACM_USER_EVT_TX_DONE is generated and a new chunk of data can be sent.

Receiving of data is performed by the app_usbd_cdc_acm_read call. The library client must set up a receive buffer which is a multiple of NRF_DRV_USBD_EPSIZE. When a data package is ready, event APP_USBD_CDC_ACM_USER_EVT_RX_DONE is generated. To get the amount of received data, the library client must call app_usbd_cdc_acm_rx_size.