Skip to content

Commit 037d350

Browse files
committed
usb: wait 100ms for transfers to finish
The host may pipeline several requests which could possibly finish before we've acknowledged them. Wait 100 ms in order to acknowledge all of these LUNs. Signed-off-by: Sean Cross <[email protected]>
1 parent 6323997 commit 037d350

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/usb/usb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ void usb_teardown(void)
9797
{
9898
if ( NRF_USBD->ENABLE )
9999
{
100-
// Abort all transfers
100+
// Wait for transfers to finish. This works around an issue wherein we
101+
// disconnect while there are still pipelined transfers going.
102+
unsigned int i;
103+
for (i = 0; i < 100; i++) {
104+
tud_task();
105+
NRFX_DELAY_MS(1);
106+
}
101107

102108
// Disable pull up
103109
nrf_usbd_pullup_disable(NRF_USBD);

0 commit comments

Comments
 (0)