AnsweredAssumed Answered

Composite USB Device with more than one instance of Class type

Question asked by steveevers on Dec 28, 2015
Latest reply on Dec 28, 2015 by Mark Butcher

I am constructing a composite USB device on a frdmk22f dev board, containing 3 class instances (1 USB_CLASS_MASS_STORAGE and 2 USB_CLASS_HID). My 2 USB_CLASS_HID's are a HID keyboard and a HID Generic.


I have not seen any examples for configuring the stack when multiple instances of the same class type are included in the composite USB device. When configuring the USB stack with the USB_Composite_Init() call it appears that multiple instances of a class type need to be treated differently than instances of different class types. The "Composite Device Users's Guide" indicates the  count element of the composite_config_struct_t represents the number of classes (rather than the number of class instances?) in the composite device.


Should this count value be the number of class types or number of class instances in the composite device? Thanks for any pointers.



// usb_class_composite.h

typedef struct _composite_config_struct


     uint8_t                                    count;               /*!< Number of class support */  

     class_config_struct_t*            class_app_callback;  /*!< Array of Endpoints Structures */




// composite initialization call

USB_Composite_Init(CONTROLLER_ID, &g_composite_device.composite_device_config_callback, &g_composite_device.composite_device);



// My USB Stack Configuration Macro Modifications



    #define MAX_HID_DEVICE                    (0x02) ... was (0x01)

    #define MAX_HID_CLASS_EP_NUM              (2)    ... was (1)



    #define CONFIG_MAX 3 ... was 2



    #define USBCFG_DEV_MAX_CLASS_OBJECT       (2) ... was (1)

    #define USBCFG_DEV_MAX_ENDPOINTS          (7) ... was (6)