Tiny45 USB device not recognized after a reboot (solution)
Posted: Wed Aug 08, 2012 9:27 am
When I developed device based on the Tiny45, I encountered a problem:
Windows could not recognize it after a reboot. It was recognizeed only after reconnecting.
I solved this problem by adding the following code:
That is, after starting the controller checks the value of usbConfiguration, if it is nonzero,
then the connection is successfully established and you can reset WDT.
If within 8 seconds, the device is not determined by the system, it goes to reboot.
Windows could not recognize it after a reboot. It was recognizeed only after reconnecting.
I solved this problem by adding the following code:
Code: Select all
# include <avr/wdt.h> / / connect the library, watch dog timer
....
int main (void / / Start of program
{
......
wdt_enable (WDTO_8S); / / give the command to restart the controller through 8 s, if WDT not reseted
for (; ;) {/ * start the main program loop * /
if (usbConfiguration! = 0) wdt_reset (); / / reset wd_timer if device connected to the USB and recognized by OS
..........
}
}
That is, after starting the controller checks the value of usbConfiguration, if it is nonzero,
then the connection is successfully established and you can reset WDT.
If within 8 seconds, the device is not determined by the system, it goes to reboot.