5 Behavior

This UDC stack implementation is based on an interrupt driven scheme. This solution ensures low latency, does not require any wait loop, and ensures OS compatibility.

Depending on the USB interrupt routine priority, the USB interrupt can be blocked by other interrupt routines with higher priority, or a critical code section. The USB hardware and software does not have any timing requirements except for the USB “Set Address” request (performed during USB enumeration phase to assign the USB address). The user must take care that the USB interrupt is not blocked during the "Set Address" request for longer than the maximum delay given in the table below.

Table 5-1. Set Address Timing
USB HostMaximum Delay(1)
Specification2ms
USB org certification tools12ms
Windows® XP48ms
Windows 7, Vista32ms
Mac Mini OSX 10.5.877ms
Ubuntu 8.04, Ubuntu 9, Open Suse 11.129ms
Fedora 9, Fedora 1024ms
Note: (1) These numbers will depend on USB host hardware, and is only a ballpark number for reference. These numbers include the time for setup retry.

USB hosts uses a timeout to reset a non-answering USB device (this time is not specified by the USB specification). The table below lists examples of operating system's timeout:

Table 5-2. OS Timeout
USB hostTimeout
Control EndpointMass Storage
Data PhaseZLP PhaseCBWData ReadCSW
SpecificationNo timeout
Windows XP5.3s5.3s19s9.3s9.3s
Windows 7, Vista5.3s5.3s19s160s/60s160s/60s
Mac Mini OSX 10.5.85.9s5.6s11s31s22s
Ubuntu 8.04, Ubuntu 9, Open Suse 11.15s5s30s30s30s
Fedora 9, Fedora 105s5s30s60s30s

The following figures describe the interaction between the different layers.

Figure 5-1. USB Device Start-up and Stop
Figure 5-2. Management of Control Endpoint
Note: The udd_g_ctrlreq variable is used to communicate between UDD and UDC/UDIs.
Figure 5-3. Typical Enumeration