From 2ba0f89663d8a770351ddb2eb2abf39bef2f20b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 3 Apr 2018 17:37:59 +0200 Subject: [PATCH] [usb] Fix Windows enumeration. Set the endpoint transfer size before enabling it. Change-Id: If3a02156f0019c9cc48159b07199dc2375387fb5 --- ion/src/device/usb/endpoint0.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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();