USB Component  Version 6.17.0
MDK Middleware for USB Device and Host Communication
Custom Class

USB Host supporting any Device Class

The Custom Class for USB Host has two use cases:

  1. Implementing/supporting a standard Device class other than CDC, HID and MSC (also CDC, HID and MSC class handling can be overridden).
  2. Implementing/supporting a vendor specific Device class.

Supporting Custom or Standard Class Devices requires the USB Host to be aware of the specific Class. On a PC, it is easy to add Class support by simply installing the required driver. However, in an embedded system this is not possible.

The Custom Class are a starting point for adding support for any USB Device Class. Furthermore, all Class Specific Requests need to be handled by the application running on the USB Host system. For more information on these requests, please consult the USB-IF Device Class Documents. The user code template file USBH_User_CustomClass.c contains all the functions that require adaptation.

The number of concurrent Custom Class Devices in a system can be configured using the USBH_Config_CustomClass.h configuration file.

USB Device implementing any Device Class

The Custom Class for USB Device has two use cases:

  1. Implementing/supporting a standard Device class other than ADC, CDC, HID, and MSC.
  2. Implementing/supporting a vendor specific Device class.

The Custom Class gives full control of the USB handling. It is designed to react on any kind of event on any of the assigned endpoints and to handle any control message that may reach the system. The application has the full capability of dealing with control messages for whatever USB Device class. Message handling control can be taken over from the USB Device Core. The user code template file USBD_User_Device.c contains all functions used for Device level Control Endpoint 0 (STANDARD, CLASS and VENDOR requests) message interception and handling, whereas file USBD_User_CustomClass.c contains all the functions used for Custom Class Control Endpoint 0 CLASS requests and Custom Class endpoint events handling.

To create the Custom Class the configuration file providing up to four interfaces with up to 8 endpoints has been provided.

USB Descriptors

Every USB Device requires certain descriptors. The following list is not complete but gives an impression about the various descriptors that may be required:

  • Standard Device Descriptor
  • Standard Configuration Descriptor
  • Standard Interface Descriptor for the Class that is implemented
  • Standard Endpoint Descriptors for IN and OUT endpoints
  • Standard String Descriptor

The necessary descriptors are automatically generated by the USB Middleware Component from the Class, Subclass, and Protocol Codes and the Interface String specified in the USBD_Config_CustomClass_n.h file. The page USB Descriptors provides more information on the topic.

Further information on how to use the Custom Class in a USB Device is given in the Reference section: