diff --git a/ion/src/device/usb/endpoint0.cpp b/ion/src/device/usb/endpoint0.cpp index 7c4a7c536..e6d3009f5 100644 --- a/ion/src/device/usb/endpoint0.cpp +++ b/ion/src/device/usb/endpoint0.cpp @@ -14,6 +14,14 @@ namespace Device { void Endpoint0::setup() { // Setup the IN direction + // Reset the device IN endpoint 0 transfer size register + class OTG::DIEPTSIZ0 dieptsiz0(0); + /* Transfer size. The core interrupts the application only after it has + * exhausted the transfer size amount of data. The transfer size is set to the + * maximum packet size, to be interrupted at the end of each packet. */ + dieptsiz0.setXFRSIZ(k_maxPacketSize); + OTG.DIEPTSIZ0()->set(dieptsiz0); + // Reset the device IN endpoint 0 control register class OTG::DIEPCTL0 diepctl0(0); // Reset value // Set the maximum packet size @@ -24,14 +32,6 @@ void Endpoint0::setup() { diepctl0.setEPENA(true); OTG.DIEPCTL0()->set(diepctl0); - // Reset the device IN endpoint 0 transfer size register - class OTG::DIEPTSIZ0 dieptsiz0(0); - /* Transfer size. The core interrupts the application only after it has - * exhausted the transfer size amount of data. The transfer size is set to the - * maximum packet size, to be interrupted at the end of each packet. */ - dieptsiz0.setXFRSIZ(k_maxPacketSize); - OTG.DIEPTSIZ0()->set(dieptsiz0); - // Setup the OUT direction setupOut();