aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/USBCore.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index d3e0170..76ceb01 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -290,9 +290,12 @@ int USB_Send(u8 ep, const void* d, int len)
if (n > len)
n = len;
- len -= n;
{
LockEP lock(ep);
+ // Frame may have been released by the SOF interrupt handler
+ if (!ReadWriteAllowed())
+ continue;
+ len -= n;
if (ep & TRANSFER_ZERO)
{
while (n--)