Control Commands for USB Devices

Last modified by Microchip on 2023/11/09 08:55

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.

bmRequestType1Specifies the type of request and the recipient. See the following table for the details of bmRequest.
bRequest1The command to be executed. The values of bRequest are listed in the descriptions of the request types.
wValue2Command parameter, if needed.
wIndex2Command parameter, if needed.
wLength2Number of additional bytes to transfer if the instruction has a data phase.

usb setup packet

Back to Top

bmRequest type

Bit FieldPurposeValue
D0 - D4Recipient0 - Device
1 - Endpoint
2 - Interface
3 - Other
4- 31 Reserved
D5 - D6Type of Request0 - Standard
1 - Class
2 - Vendor
3 - Reserved
D7Direction0 - 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

Back to Top

Device Requests

1000 0000bGET_STATUS
( 0 )
Returns the status of the device. Primarily used to determine if the device is capable of Remote Wake-up, and whether or not the device is Self or Bus-powered.
Disables either the DEVICE_REMOTE_WAKEUP or the TEST_MODE feature.
0000 0000bSET_FEATURE
Enables either the DEVICE_REMOTE_WAKEUP or the TEST_MODE feature.
0000 0000bSET_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.

Back to Top

Interface Requests

1000 0001bGET_STATUS
Returns the status of the interface. Currently both returned bytes are reserved for future use.
Disables an interface feature.
0000 0001bSET_FEATURE
Enables the specified interface feature.
Retrieve the index for the currently active interface.
Indicated with interface to activate.

Back to Top

Endpoint Requests

1000 0010bGET_STATUS
Returns the status of the endpoint.
Disables an endpoint feature.
0000 0010bSET_FEATURE
Enable endpoint feature.
1000 0010bSYNCH_FRAME
Used to report endpoint synchronization frame.

Back to Top

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)
  • Clear TT Buffer (CLEAR_TT_BUFFER)
  • Reset TT (RESET_TT)
  • Get TT State (GET_TT_STATE)
  • Stop TT (STOP_TT)

Back to Top