summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorme-no-dev <[email protected]>2020-07-02 13:05:17 +0300
committerme-no-dev <[email protected]>2020-07-02 13:05:17 +0300
commitd493724a7bd0f4dca718f478aec301d299bd5416 (patch)
tree2230565c23cfd77a491947cf8db8948de179177f
parent0c9932440b794fbdc699df6f0601f6febddedfe5 (diff)
ESP32-S2: Detect EP IN Xfer Timeout
In some rare ocasions (bad cable, noise, etc.) data transfer might timeout and hang the endpoint, unless the interrupt flag is cleared. This pull request targets to solve that case.
-rw-r--r--src/portable/espressif/esp32s2/dcd_esp32s2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/portable/espressif/esp32s2/dcd_esp32s2.c b/src/portable/espressif/esp32s2/dcd_esp32s2.c
index d49b69a10..3d30b6016 100644
--- a/src/portable/espressif/esp32s2/dcd_esp32s2.c
+++ b/src/portable/espressif/esp32s2/dcd_esp32s2.c
@@ -637,6 +637,13 @@ static void handle_epin_ints(void)
USB0.dtknqr4_fifoemptymsk &= ~(1 << n);
}
}
+
+ // XFER Timeout
+ if (USB0.in_ep_reg[n].diepint & USB_D_TIMEOUT0_M) {
+ // Clear interrupt or enpoint will hang.
+ USB0.in_ep_reg[n].diepint = USB_D_TIMEOUT0_M;
+ // Maybe retry?
+ }
}
}
}