Browse Source

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.
me-no-dev 5 years ago
parent
commit
d493724a7b
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/portable/espressif/esp32s2/dcd_esp32s2.c

+ 7 - 0
src/portable/espressif/esp32s2/dcd_esp32s2.c

@@ -637,6 +637,13 @@ static void handle_epin_ints(void)
           USB0.dtknqr4_fifoemptymsk &= ~(1 << n);
           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?
+      }
     }
     }
   }
   }
 }
 }