Transferred from: http://m.blog.csdn.net/blog/luckywang1103/25244091
The 9th chapter of the USB protocol refers to the USB visible device status [Universal Serial Bus Specification, section 9.1.1, Pg 239], which is divided into connections (attached), power-On (Powered), defaults (default ), address, configuration (configured), and suspend (Suspended) 6 states. The so-called visible, that is, the USB system and the host visible state, other states are within the USB device and not visible. Where the power supply, the general can be divided into the following three categories:
1. Connection status (attached): The device is connected, but no power is provided.
2. Power-on Status (Powered): The device is reset (reset), or in the address, configuration status. (See USB enumeration process, USB specification, page 241)
3. Suspend status (Suspended): 3 Ms No bus activity in the power-saving state, the device is not available, but still maintain the original USB address and configuration.
Device Hangs
We know that in a USB system, the hub or root hub will periodically send the SOF package (Start of Frame, full speed USB every 1ms, high-speed USB is 125µs send one) in normal state. Depending on the USB protocol, if the USB cable has been idle (idle) for more than 3MS, the device should treat it as a hang (Suspended) signal, require the device to enter a suspended state within 10ms, and reduce the current required by the device to the specified value (for Low-power devices, The requirements are 500µa, while for high-power or for devices that support remote wake-up (wakeup) functionality, the 2.5mA "section 7.2.3, Pg176"). In the suspended state, the device must continue to supply voltage to the pull-up resistor of the data item d+/d-to maintain the idle state. For USB2.0 high-speed equipment, there are additional requirements:
1. After receiving the suspend signal (3MS idle), the high-speed device should switch to the full speed state within 0.125ms, that is, to remove the terminating resistor and to re-attach the 1.5k pull-up resistor on the d+ data line.
2. The device detects the status on the data cable within the subsequent 100-875µs. If the status is a full speed J, then the host sends a hang signal, and if the state is SE0, the host drive data cable d+ to 0, which is a reset signal (the reset signal lasts at least 10ms time).
It is important to note that the high-speed device is in high-speed mode when it is suspended, except that it uses a full-speed signal. Once recovered from the suspended state, it will immediately enter a high-speed operation without the need for a reset.
USB High Speed Suspend Signal
As shown, host stops sending SOF at point A, the system is in SE0 state, B is 3ms time point, after the 125µs, the device removes the terminating resistor and hangs on 1.5k pull-up. At this time, if the host is sending a suspend signal, then it will not drive d+ data cable, causing d+ to be pulled up by the device, forming a full speed J state. After the C point, the 100-875ΜS device detects the host behavior at this time and discovers that it is a suspend signal, and the device enters a low-power suspend (suspend) state. (If the Hsot sends a reset signal, then when the device in the C-point hanging 1.5k resistor, due to the host to the D+ line drive role, d+ line can not be pulled high, still in the SE0 state, the device after the C point of detection, found or SE0 state, After 10ms can be determined that this is a reset signal, the device reset operation. )
Wake-up of the device
When the device is in a suspended state, the active (non-idle) signal on any bus can wake/resume the device and exit the low-power mode. (Again, the device can also change the host, such as when the computer is on standby via the USB keyboard to change the console, this function is called "Remote Wake" (wakeup), is not within the scope of this article. )
Because the device hangs at full speed, when host needs to leave the device out of the suspend state, it needs to send a fulll-K state with a duration of more than 20ms. The device sees the end of the K-state wake up within 1.3us, and host needs to send usof signal in 3ms to maintain the normal high-speed signal mode, otherwise the device will enter the suspend. As shown in the following:
USB Suspend and Wake (Suspend and Resume) "Go"