USB Library
CDC Client Driver
Communication Device Class (CDC) Host

 

CDC - Overview

Several type of communication can benefit from USB. Communication Device Class specification provides common specification for communication devices. There are three classes that make up the definition for communications devices: 

* Communications Device Class 

* Communications Interface Class 

* Data Interface Class. 

The Communications Device Class is a device-level definition and is used by the host to properly identify a communications device that may present several different types of interfaces. 

The Communications Interface Class defines a general-purpose mechanism that can be used to enable all types of communications services on the Universal Serial Bus (USB). This interface consist of two elements, a management element and a notification element. The management element configures and controls the device, it consist of endpoint 0. Notification element is optional and is used to handle transport events. In the current stack notification element is not implemented. 

The Data Interface Class defines a general-purpose mechanism to enable bulk or isochronous transfer on the USB when the data does not meet the requirements for any other class. This interface is used to transmit/receive data to/from the device. The type of endpoints belonging to a Data Class interface are restricted to being either isochronous or bulk, and are expected to exist in pairs of the same type (one In and one Out). Current version of the stack is tested for Bulk transfers.

Class-Specific Codes

This section lists the codes for the Communications Device Class, Communications Interface Class and Data Interface Class, including subclasses and protocols supported in the current version of the stack. The current version of the stack supports RS232 emulation over USB. Below is the list of codes to support this functionality. 

The following table defines the Communications Device Class code:

Code 
Class 
0x02 
Communications Device Class 
Communication Interface Codes

The following table defines the Communications Class code:

Code 
Class 
0x02 
Communications Interface Class 

CDC specification mentions various subclass , current version of the Microchip CDC host stack supports below mentioned subclasses. The following table defines the currently supported Subclass codes for the Communications Interface Class:

Code 
SubClass 
0x02 
Abstract Control Model 

The following table defines supported Communications Class Protocol Codes:

Code 
Protocol 
0x01 
AT Commands: V.250 etc. 
Data Interface Code

The following table defines the Data Interface Class code:

Code 
Class 
0x0A 
Data Interface Class 

No specific Subclass and Protocol codes are required to achieve RS232 functionality over USB.

Communication and Data Transfer Handling

Communication Management : The CDC client deriver takes care of enumerating the device connected on the bus. The application must define Line Coding parameters in file usb_config.h . USBConfig utility can be used to set these parameters. If the connected device complies with the setting then the device is successfully attached else the device is not attached onto the bus. If the application needs to change the setting dynamically after the device has been successfully enumerated , interface function USBHostCDC_Api_ACM_Request()can be used to do so. Following standard requests are currently implemented: 

 

Request 
Summary 
SendEncapsulatedCommand 
Issues a command in the format of the supported control protocol. 
GetEncapsulatedResponse 
Requests a response in the format of the supported control protocol. 
SetLineCoding 
Configures DTE rate, stop-bits, parity, and number-of-character bits. 
GetLineCoding 
Requests current DTE rate, stop-bits, parity, and number-of-character bits. 
SetControlLineState 
[V24] signal used to tell the DCE device the DTE device is now present. 

Data transfers : Once the device is attached the application is ready to start data transfers. Usually two endpoints one in each direction are supported by the device. 

* To receive data from the device the application must set up a IN request at the rate depending on the baudrate settings. Application can use a timer interrupt to precisely set up the request. Function USBHostCDC_Api_Get_IN_Data()is used to setup the request. Maximum of 64 bytes can be received in single transfer. 

* To transmit data to the device application must set up a OUT request. Function USBHostCDC_Api_Send_OUT_Data()is used to setup out request. Any amount of data can be transferred to the device. The Client driver takes care of sending the data in 64 bytes packet. 

* USBHostCDC_ApiTransferIsComplete() is used to poll for the status of previous transfer. 

* USBHostCDC_ApiDeviceDetect() is used to get the status of the device. If the device is ready for new transfer then the function returns TRUE.

Files
Name 
Description 
This is file usb_host_cdc.h. 
This is file usb_host_cdc_interface.h. 
Macros
 
Name 
Description 
 
This is macro _USB_HOST_CDC_H_. 
 
This is macro _USB_HOST_CDC_INTERFACE_H_. 
Topics
Name 
Description 
 
 
MLA - USB Library Help Version : 2.16
http://www.microchip.com/mla