USB Libraries Help > USB Device Libraries > USB CDC Device Library > Using the Library > Abstraction Model
MPLAB Harmony USB Stack
Abstraction Model

The CDC Function Driver offers services to a USB CDC Device to communicate with the host by abstracting the USB specification details. It must be used along with the USB Device Layer and USB controller to communicate with the USB Host. Figure 1 shows a block diagram of the MPLAB Harmony USB Architecture and where the CDC Function Driver is placed.

Figure 1: CDC Function Driver 

As shown in Figure 1, the USB Controller Driver takes the responsibility of managing the USB peripheral on the device. The USB Device Layer handles the device enumeration, etc. The USB Device_layer forwards all USB CDC specific control transfers to the CDC Function Driver. The CDC Function Driver ACM sub-layer interprets the control transfers and requests application's intervention through event handlers and well defined set of API. The application must register a event handler with the CDC Function Driver in the Device Layer Set Configuration Event. The application should respond to CDC ACM events. Response to CDC ACM event that require control transfer response can be deferred by responding to the event after returning from the event handler. The application interacts directly with the CDC Function Driver to send/receive data and to send serial state notifications. 

As per the CDC specification,a USB CDC Device is a collection of the following interfaces: 

  • Communication Interface (Device Management) on Endpoint 0
  • Optional Communication Interface (Notification) on an interrupt endpoint
  • Optional Data Interface (either a bulk or isochronous endpoint)

 

Figure 2: CDC Function Driver Architecture

Figure 2 shows the architecture of the CDC Function Driver. The device management on Endpoint 0 is handled by the device library(class specific requests are routed to the CDC Function Driver by the USB Device Layer). An instance of the CDC Function Driver actually consists of a data interface and a notification interface. The library is implemented in two .c files. The usb_device_cdc.c file implements the CDC data and serial state notification, while the usb_device_cdc_acm.c file implements the control transfer interpretation and event generation. The application must respond to control transfer related CDC ACM events by directly calling the Device Layer control transfer routines.