Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB Device Controller (UDC) - Workflow

Common workflow for all USB devices.

  1. Ensure that conf_usb.h is available and contains the following configuration which is the main USB device configuration:
    • // Vendor ID provided by USB org (ATMEL 0x03EB)
      #define USB_DEVICE_VENDOR_ID 0x03EB // Type Word
      // Product ID (Atmel PID referenced in usb_atmel.h)
      #define USB_DEVICE_PRODUCT_ID 0xXXXX // Type Word
      // Major version of the device
      #define USB_DEVICE_MAJOR_VERSION 1 // Type Byte
      // Minor version of the device
      #define USB_DEVICE_MINOR_VERSION 0 // Type Byte
      // Maximum device power (mA)
      #define USB_DEVICE_POWER 100 // Type 9-bits
      // USB attributes to enable features
      #define USB_DEVICE_ATTR USB_CONFIG_ATTR_BUS_POWERED // Flags
  2. Call the USB device stack start function to enable stack and start USB:
    • Note
      In case of USB dual roles (Device and Host) managed through USB OTG connector (USB ID pin), the call of udc_start() must be removed and replaced by uhc_start(). SeRefer to "AVR4950 section 6.1 Dual roles" for further information about dual roles.