Specifications
10
6263A–ATARM–10-Oct-06
Application Note
If a PIO pin is connected to VBus, it is possible to monitor it by configuring the pin as an input
and enabling the PIO interrupt. The interrupt service routine should simply call the USB_Attach
function, which checks the Vbus line and either attaches or detaches the device accordingly.
Finally, if an OS is being used, then the driver should probably be installed prior to use. Interrupt
configuration may also be done differently. Please refer to the documentation of the OS for more
information.
This callback is mandatory.
3.4.3 Reset
When an End of bus reset has been detected, the Reset callback is triggered. The callback
should perform initialization or re-initialization of the user-level application. For example, a
class driver like MSD should re-initialize its internal state when a USB reset is performed.
3.4.4 Suspend
When the USB device enters the Suspended state, the USB API notifies this state change by
invoking the Suspend callback. This can happen either when the bus is idle or when the device
is disconnected from the USB.
If the device should enter low-power mode when suspended, then this callback must perform the
required operations to do so, e.g., switching to a slow clock, disabling PLLs, etc.
Note: The electrical specification of the USB 2.0 defines a maximum current consumption of 500 µA for
suspended devices. This includes the current passing through pull-ups and pull-downs.
3.4.5 Resume
The Resume callback is invoked when the USB device leaves the Suspended state and returns
to its previous state (either Powered, Default, Address or Configured). This may happen when
activity is detected on the USB, or when the device gets connected.
If the device was in low-power mode because of the Suspend callback, then this callback must
perform the necessary operations to return the device into a normal operating mode, e.g.,
switching to a fast clock.
3.4.6 NewRequest
When a SETUP request is received on a control endpoint, the USB API layer triggers the
NewRequest callback to notify the user application. The received request can then be accessed
through the corresponding S_usb structure (see Section 3.2.1 on page 2).
SETUP packets are used for class-specific requests (e.g. GetMaxLUN in MSD) as well as stan-
dard USB requests (e.g. SetConfiguration). The former are described in USB Device Class
Documents, such as the Mass Storage Bulk Only 1.0; the latter are defined in the USB Specifi-
cation 2.0.
Note that SETUP requests which are not understood by the device should be acknowledged
with a STALL handshake. This notifies the host that the device cannot process the command.
This callback is mandatory.
3.4.7 StartOfFrame
Every 1 ms (for a full-speed device) or 125 µs (for a high-speed device) a new USB frame starts.
A callback can be invoked whenever this occurs.