FX2LP: Dual Virtual COM Port Descriptors - KBA229819

Version 3

    Version: **

     

    Question: How can I configure the descriptors of FX2LP to enumerate it as a dual CDC device with two COM ports?

    Answer:

    The following descriptors are needed in an USB CDC Abstract Control Management (ACM) device:

    • Standard Device Descriptor
    • Standard Configuration Descriptor
    • Interface Association Descriptor
    • CDC Header Functional Descriptor
    • CDC Union Functional Descriptor
    • Call Management Functional (CM) Descriptor
    • Abstract Control Management (ACM) Descriptor
    • Standard Interface Descriptor for CDC Class Communication Interface
    • Standard Endpoint Descriptor for Interrupt IN Endpoint
    • Standard Interface Descriptor for CDC Class Data Interface
    • Standard Endpoint Descriptor for Bulk IN and Bulk OUT Endpoint

    For the FX2LP to enumerate with multiple COM ports (CDC device), it should be configured as a multifunction device, also known as a composite device. A composite device will support more than one device class, that is, the device can perform multiple functions simultaneously. For example, the device can function as a keyboard and a mouse.

    This knowledge base article (KBA) is for configuring FX2LP as a dual CDC class device.

    Each CDC class device needs two interfaces:

    • Communication Interface: With one interrupt endpoint
    • Data Interface: With two bulk endpoints (one each for IN and OUT transfers)

     

    Interface Association Descriptor (IAD) allows the device to group interfaces that belong to a function. IAD is used to group the Communication and Data interfaces into a single interface for each CDC device, so that these two interfaces will be combined and will enumerate as a single device (CDC) on the host PC.

    For ‘x’ CDC class devices to be configured, ‘2x’ interfaces are needed (‘x’ Data interfaces and ‘x’ Communication interfaces).

    Defining Descriptors:

    USB IF has devised a specific class and protocol code set that notifies the operating system whether one or more IADs are present in the device firmware. The class and the protocol set are defined in this section.

    Set the Device Class descriptors for the device as follows:

    bDeviceClass: 0xEF

    bDeviceSubClass: 0x02

    bDeviceProtocol: 0x01

    High Speed Configuration Descriptors:

    Set the number of interfaces to 4; two interfaces (Communication and Data interface) for each CDC device.

    After the Configuration descriptors are defined, IAD needs to be initialized for each CDC device followed by its Interface descriptors for Communication interface and Data interface.

    Each Interface descriptor should be followed by their corresponding Endpoint descriptor.

    For the Interface Association descriptors, Microsoft recommends that the first interface in the interface collection under the IAD have class and subclass fields that match the class and subclass fields of the IAD. See Table 1.

    Table 1. IAD Function Class and Subclass

    IAD Field

    Corresponding Interface Field

    bFunctionClass

    bInterfaceClass

    bFunctionSubclassClass

    bInterfaceSubClass

     

    The FX2LP descriptor file (dscr.A51) attached with this KBA contains the required descriptors to enumerate FX2LP on the host as a dual CDC Class Device with two COM ports, both in high speed.

     

    See the firmware project in this thread where AN58764 is altered to implement dual Virtual COM port using FX2LP.