USB_Options = Options;\r
#endif\r
\r
- USB_INT_RegisterHandlers();\r
-\r
#if defined(USB_CAN_BE_BOTH)\r
if (Mode == USB_MODE_UID)\r
{\r
}\r
else\r
{\r
+ AVR32_USBB.USBCON.uide = false;\r
USB_CurrentMode = Mode;\r
}\r
#endif\r
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC);\r
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0);\r
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].diven = (F_CLOCK != 48000000UL);\r
- AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].div = ((F_CLOCK / 2) / 48000000UL);\r
+ AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].div = (F_CLOCK == 48000000UL) ? 0 : (uint32_t)(((F_CLOCK / 48000000UL) - 1) / 2);\r
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].cen = true;\r
\r
USB_INT_DisableAllInterrupts();\r
USB_INT_Enable(USB_INT_EORSTI);\r
\r
USB_Attach();\r
+ USB_Device_SetDeviceAddress(0);\r
}\r
#endif\r
\r