Modules | Functions
USB Device Controller (UDC)
Collaboration diagram for USB Device Controller (UDC):

Modules

 Implementation of UDC
 
 USB Device Controller (UDC) - Prerequisites
 
 USB Device Controller (UDC) - Example code
 
 USB Device Controller (UDC) - Workflow
 
 USB Device Descriptor
 

Functions

static void udc_attach (void)
 Attach device to the bus when possible. More...
 
static void udc_detach (void)
 Detaches the device from the bus. More...
 
usb_iface_desc_t UDC_DESC_STORAGEudc_get_interface_desc (void)
 Returns a pointer on the current interface descriptor. More...
 
static bool udc_include_vbus_monitoring (void)
 Authorizes the VBUS event. More...
 
static void udc_remotewakeup (void)
 The USB driver sends a resume signal called "Upstream Resume" This is authorized only when the remote wakeup feature is enabled by host. More...
 
void udc_start (void)
 Start the USB Device stack. More...
 
void udc_stop (void)
 Stop the USB Device stack. More...
 

Detailed Description

The UDC provides a high-level abstraction of the usb device. You can use these functions to control the main device state (start/attach/wakeup).

USB Device Custom configuration

The following USB Device configuration must be included in the conf_usb.h file of the application.

USB_DEVICE_VENDOR_ID (Word)
Vendor ID provided by USB org (ATMEL 0x03EB).

USB_DEVICE_PRODUCT_ID (Word)
Product ID (Referenced in usb_atmel.h).

USB_DEVICE_MAJOR_VERSION (Byte)
Major version of the device

USB_DEVICE_MINOR_VERSION (Byte)
Minor version of the device

USB_DEVICE_MANUFACTURE_NAME (string)
ASCII name for the manufacture

USB_DEVICE_PRODUCT_NAME (string)
ASCII name for the product

USB_DEVICE_SERIAL_NAME (string)
ASCII name to enable and set a serial number

USB_DEVICE_POWER (Numeric)
(unit mA) Maximum device power

USB_DEVICE_ATTR (Byte)
USB attributes available:

USB_DEVICE_LOW_SPEED (Only defined)
Force the USB Device to run in low speed

USB_DEVICE_HS_SUPPORT (Only defined)
Authorize the USB Device to run in high speed

USB_DEVICE_MAX_EP (Byte)
Define the maximum endpoint number used by the USB Device.
This one is already defined in UDI default configuration. Ex:

Function Documentation

◆ udc_attach()

static void udc_attach ( void  )
inlinestatic

Attach device to the bus when possible.

Warning
If a VBus control is included in driver, then it will attach device when an acceptable Vbus level from the host is detected.

Definition at line 185 of file udc.h.

◆ udc_detach()

static void udc_detach ( void  )
inlinestatic

Detaches the device from the bus.

The driver must remove pull-up on USB line D- or D+.

Definition at line 196 of file udc.h.

◆ udc_get_interface_desc()

usb_iface_desc_t UDC_DESC_STORAGE* udc_get_interface_desc ( void  )

Returns a pointer on the current interface descriptor.

Returns
pointer on the current interface descriptor.

Definition at line 155 of file udc.c.

◆ udc_include_vbus_monitoring()

static bool udc_include_vbus_monitoring ( void  )
inlinestatic

Authorizes the VBUS event.

Returns
true, if the VBUS monitoring is possible.

VBus monitoring used cases

The VBus monitoring is used only for USB SELF Power application.

  • By default the USB device is automatically attached when Vbus is high or when USB is start for devices without internal Vbus monitoring. conf_usb.h file does not contains define USB_DEVICE_ATTACH_AUTO_DISABLE.
    //#define USB_DEVICE_ATTACH_AUTO_DISABLE
  • Add custom VBUS monitoring. conf_usb.h file contains define USB_DEVICE_ATTACH_AUTO_DISABLE:
    #define USB_DEVICE_ATTACH_AUTO_DISABLE
    User C file contains:
    // Authorize VBUS monitoring
    // Implement custom VBUS monitoring via GPIO or other
    }
    Event_VBUS_present() // VBUS interrupt or GPIO interrupt or other
    {
    // Attach USB Device
    }
  • Case of battery charging. conf_usb.h file contains define USB_DEVICE_ATTACH_AUTO_DISABLE:
    #define USB_DEVICE_ATTACH_AUTO_DISABLE
    User C file contains:
    Event VBUS present() // VBUS interrupt or GPIO interrupt or ..
    {
    // Authorize battery charging, but wait key press to start USB.
    }
    Event Key press()
    {
    // Stop batteries charging
    // Start USB
    }

Definition at line 165 of file udc.h.

◆ udc_remotewakeup()

static void udc_remotewakeup ( void  )
inlinestatic

The USB driver sends a resume signal called "Upstream Resume" This is authorized only when the remote wakeup feature is enabled by host.

Definition at line 205 of file udc.h.

◆ udc_start()

void udc_start ( void  )

Start the USB Device stack.

Definition at line 351 of file udc.c.

◆ udc_stop()

void udc_stop ( void  )

Stop the USB Device stack.

Definition at line 358 of file udc.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:01