Skip to content

Commit c74938c

Browse files
committed
USBHost: Wait for device to implement SET ADDRESS
The USB Device must change the address 2 ms after completing SET ADDRESS status stage. Wait 2 ms before issuing GET DESCRIPTOR under the new address. In my case, this completely resolves the timeout issues.
1 parent c4cc9c4 commit c74938c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

features/unsupported/USBHost/USBHost/USBHost.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ void USBHost::usb_process()
163163
devices[i].activeAddress(true);
164164
USB_DBG("Address of %p: %d", &devices[i], devices[i].getAddress());
165165

166+
// Wait for the device to actually set the address. The Status stage
167+
// of SET ADDRESS happens before the device implements the request.
168+
// USB Device must take the new address into use within 2 ms after
169+
// completing SET ADDRESS status stage
170+
ThisThread::sleep_for(2);
171+
166172
// try to read again the device descriptor to check if the device
167173
// answers to its new address
168174
res = getDeviceDescriptor(&devices[i], buf, 8);

0 commit comments

Comments
 (0)