nRF5 SDK v16.0.0
USB CDC ACM module
This information applies to the following SoCs: nRF52833 and nRF52840.

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:

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.

There are two ways to receive data. First one is the app_usbd_cdc_acm_read function. Class instance has internal receive buffer, to extract data from it the library client must provide number of bytes to read and a buffer to store them. Next action should be based on return value:

Second option to use for receiving is app_usbd_cdc_acm_read_any function. It is very similar to previous one but it returns data as quick as any data is available, even if the given buffer was not totally full. Return values and their meaning are the same, but this function cannot use double buffering. To check the number of bytes really read use app_usbd_cdc_acm_rx_size function


Documentation feedback | Developer Zone | Subscribe | Updated