
Atmel AVR49011
13
8481A-AVR-01/12
7.2 USB configuration
All USB stack configurations are stored in the conf_usb.h file in the application
module. These configurations are simple and do not require any specific USB
knowledge.
There is one configuration section for each USB modules: UDC, UDI and UDD.
The UDC configuration possibilities are described in the Atmel AVR4900: ASF – USB
Device Stack application note in the Section 7.1.1: USB device configuration”.
The UDD configuration possibilities are described in the Atmel AVR4900: ASF – USB
Device Stack application note in the Section 7.1.3: USB drivers’ configuration”.
The UDI which is the vendor interface require some configuration described in Table
7-1.
Table 7-1. UDI vendor – configuration.
Define name Type Description
UDI_VENDOR_ENABLE_EXT Call-back function
Call-back function called when vendor interface is enabled
UDI_VENDOR_DISABLE_EXT Call-back function Call-back function called when vendor interface is disabled
UDI_VENDOR_SETUP_OUT_RECEIVED Call-back function Call-back function called when OUT setup request is received
UDI_VENDOR_SETUP_IN_RECEIVED Call-back function Call-back function called when IN setup request is received
UDI_VENDOR_EPS_SIZE_INT_FS
UDI_VENDOR_EPS_SIZE_BULK_FS
UDI_VENDOR_EPS_SIZE_ISO_FS
constant
Interrupt endpoints size for full speed (up to 64)
Bulk endpoints size for full speed (8, 16, 32 or 64)
Isochronous size for full speed (up to 1023)
UDI_VENDOR_EPS_SIZE_INT_HS
UDI_VENDOR_EPS_SIZE_BULK_HS
UDI_VENDOR_EPS_SIZE_ISO_HS
constant
Interrupt endpoints size for full speed (up to 1024)
Bulk endpoints size for full speed (8, 16, 32,..,512)
Isochronous size for full speed (up to 1024)
NOTE It is important to verify the configuration defined in conf_clock.h file, because the
USB hardware requires a specific clock frequency (see comment in conf_clock.h
file).
7.3 USB implementation
This section describes source code to add to run a USB device vendor application.
The implementation is made of three steps:
1. Start USB device.
2. Wait the enable of vendor interface by the Host.
3. Transfer data on USB bus.
7.3.1 USB device control
Only two function calls are needed to start a USB device application, see Figure 7-1.