Specifications

14
6263A–ATARM–10-Oct-06
Application Note
Possible values: YES, NO.
Default: NO.
•LEDS
Optional, enables the program to use the board LEDs to signal device activity.
Possible values: YES, NO.
Default: NO.
TRACES
Optional, enables the program to use the DBGU port to output debug traces.
Possible values: YES, NO.
Here are some usage examples:
Default compilation: builds the project for an AT91SAM7S64 on a AT91SAM7S-EK:
nmake
Builds the framework for an AT91SAM7X256 on an AT91SAM7X-EK, in debug mode:
nmake TARGET=AT91SAM7X256 BOARD=AT91SAM7XEK DEBUG=YES
Minimum power consumption: remap, no LED display and no debug traces:
nmake REMAP=YES LEDS=NO TRACES=NO
5. Example: USB Enumeration
This section is a step-by-step guide on how to use the USB framework to produce a simple pro-
gram that performs USB enumeration. In this example, everything is put into a single file. You
can look at the core_main.c file provided with the framework to view the end result.
5.1 Including the Necessary Headers
Prior to using the framework, several header files have to be included. Please refer to Section
4.2 on page 13 for more information on that step.
5.2 Declaring Global Variables
Several object instances are necessary to use the various functions and methods of the USB
framework. They are detailed below.
5.2.1 USB Driver
The very first step is to declare the USB driver which is then used by the Class driver. The S_usb
structure is used as a container for several variables (see Section 3.2.1 on page 2), which must
therefore be created first.
5.2.1.1 Endpoints
Depending on the application, a particular number of endpoints have to be defined. For exam-
ple, an MSD driver needs three endpoints whereas a CDC driver needs four. Refer to the
corresponding specification for more information about the required number of endpoints. Since
this example should only perform the USB enumeration, it will declare only one endpoint: Con-
trol endpoint 0.