aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/XMEGA
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA')
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index 9f44dc46a..df45f7444 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
@@ -40,7 +40,7 @@ volatile uint8_t USB_CurrentMode = USB_MODE_None;
volatile uint8_t USB_Options;
#endif
-USB_EP_TABLE_t USB_EndpointTable ATTR_ALIGNED(2);
+USB_EP_TABLE_t USB_EndpointTable ATTR_ALIGNED(4);
void USB_Init(
#if defined(USB_CAN_BE_BOTH)
@@ -72,6 +72,8 @@ void USB_Init(
NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));
+ USB.EPPTR = (intptr_t)&USB_EndpointTable;
+
if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH)
USB.INTCTRLA = (3 << USB_INTLVL_gp);
else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED)
@@ -81,7 +83,7 @@ void USB_Init(
SetGlobalInterruptMask(CurrentGlobalInt);
- USB_ResetInterface();
+ USB_ResetInterface();
}
void USB_Disable(void)
@@ -102,6 +104,8 @@ void USB_ResetInterface(void)
else
CLK.USBCTRL = ((((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp) | CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
+ USB_Device_SetDeviceAddress(0);
+
USB_INT_DisableAllInterrupts();
USB_INT_ClearAllInterrupts();