Control Commands for USB Devices

USB provides the host the ability to send control commands to standard devices as well as Hubs. Devices receive the control commands on endpoint 0.

Setup Packet

Each control request starts with an 8-byte Setup Packet.
Field Size
bmRequestType 1 Specifies the type of request and the recipient. See the following table for the details of bmRequest.
bRequest 1 The command to be executed. The values of bRequest are listed in the descriptions of the requests types.
wValue 2 Command parameter, if needed.
wIndex 2 Command parameter, if needed.
wLength 2 Number of additional bytes to transfer if the instruction has a data phase.

bmRequest type

Bit Field Purpose Value
D0 - D4 Recipient 0 - Device
1 - Endpoint
2 - Interface
3 - Other
4-31 Reserved
D5 - D6 Type of Request 0 - Standard
1 - Class
2 - Vendor
3 - Reserved
D7 Direction 0 - Host to Device
1 - Device to Host

Many commands require no additional data and are completed by the device within 50 ms of sending the Setup Packet. Requests which require a data phase must be completed by the device within 500 ms of the packet being sent.

There are four types of control commands:

  • Device Requests
  • Interface Requests
  • Endpoint Requests
  • Hub Requests

Device Requests

bmRequestType bRequest Description
1000 0000b GET_STATUS
( 0 )
Returns the status of the device. Primarily used to determine if the device is capable of Remote Wake-up, and whether of not the device is Self or Bus-powered.
0000 0000b CLEAR_FEATURE
Disables either the DEVICE_REMOTE_WAKEUP , or the TEST_MODE feature.
0000 0000b SET_FEATURE
Enables either the DEVICE_REMOTE_WAKEUP , or the TEST_MODE feature.
0000 0000b SET_ADDRESS
During enumeration this instruction is used to assign an address (1 -127) to the device.
Returns the descriptor table selected by the wValue parameter.
Sets the specified descriptor value.
Returns the index value for the active device configuration.
Cause the specified device configuration to become active.

Interface Requests

bmRequestType bRequest Description
1000 0001b GET_STATUS
Returns the status of the interface. Currently both returned bytes are "reserved for future use."
0000 0001b CLEAR_FEATURE
Disables an interface feature.
0000 0001b SET_FEATURE
Enables the specified interface feature.
1000 0001b GET_INTERFACE
Retrieve the index for the currently active interface.
0000 0001b SET_INTERFACE
Indicated with interface to activate.

Endpoint Requests

bmRequestType bRequest Description
1000 0010b GET_STATUS
Returns the status of the end point.
0000 0010b CLEAR_FEATURE
Disables an endpoint feature.
0000 0010b SET_FEATURE
Enable endpoint feature.
1000 0010b SYNCH_FRAME
Used to report endpoint synchronization frame.

Hub Requests

Get Hub Status (GET_STATUS)
Get Port Status (GET_STATUS)
Clear Hub Feature (CLEAR_FEATURE)
Clear Port Feature (CLEAR_FEATURE)
Get Bus State (GET_STATE) obsolete since USB 2.0
Set Hub Feature (SET_FEATURE)
Set Port Feature (SET_FEATURE)
Get Hub Descriptor (GET_DESCRIPTOR)
Set Hub Descriptor (SET_DESCRIPTOR)

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.