Showing results for 
Search instead for 
Did you mean: 

Knowledge Base Articles

USB device not working after restarting the Windows 7 PC

Not applicable

USB device not working after restarting the Windows 7 PC

Question: USB device not working after restarting the Windows 7 PC. Why?



Till Windows Vista RTm, all the USB devices attached to the PC undergoes a USB reset, when the OS resumes or restarts. This makes sure that the device enumerates once the PC is restarted or resumed. However, from Windows 7 onwards, this bus wide USB reset is disabled. This enables the devices connected to the PC to maintain device-specific states even after restarting the PC. This significantly decreases the time it takes for the USB devices to be available after system resume.

However, this feature of the OS may lead to malfunctioning of the device, if the device firmware is written in such a way that enumeration of USB is done outside the main while(1) loop. In this case, the device is never reset when the PC restarts and hence, the enumeration API is never executed again. 

In the attached project, enumeration of the device is done in a conditional IF statement within the main while(1) loop by checking the 'bDeviceEnumerated' which is initialised to FALSE. Once the enumeration is complete, this flag is set to TRUE . Hence, control doesn't reach the enumeration API once device is enumerated. 

The firmware is written to detect the PC restart condition. This is done by monitoring the SOF packets. On reception of every SOF packets, a counter 'bCtr' is cleared in the SOF ISR. Within the SLEEP Timer ISR, the same counter is incremented. If the SOF packets are not received for some time, the bCtr counter value will get incremented above definable threshold value at which the 'bDeviceEnumerated' flag is set to FALSE value. 

Once the flag is set to FALSE, the firmware control reaches the enumeration API and  enumerates the device on PC. With this firmware implementation, device works even after restarting the PC

This firmware is compliant with USB chapter 9 tests

Version history
Revision #:
1 of 1
Last update:
‎Jan 29, 2012 11:55 PM
Updated by: