File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/portable/synopsys/dwc2 Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1025,6 +1025,8 @@ static void handle_ep_irq(uint8_t rhport, uint8_t dir) {
10251025 }
10261026}
10271027
1028+ extern bool tud_connected (void );
1029+
10281030/* Interrupt Hierarchy
10291031 DIEPINT DIEPINT
10301032 \ /
@@ -1060,8 +1062,12 @@ void dcd_int_handler(uint8_t rhport) {
10601062
10611063 if (gintsts & GINTSTS_USBSUSP ) {
10621064 dwc2 -> gintsts = GINTSTS_USBSUSP ;
1063- dwc2 -> gintmsk &= ~GINTMSK_USBSUSPM ;
1064- dcd_event_bus_signal (rhport , DCD_EVENT_SUSPEND , true);
1065+ // Some MCUs such as AT32F405 receives SUSPEND event before the device is
1066+ // connected. We should skip handling the event if not currently connected.
1067+ if (tud_connected ()) {
1068+ dwc2 -> gintmsk &= ~GINTMSK_USBSUSPM ;
1069+ dcd_event_bus_signal (rhport , DCD_EVENT_SUSPEND , true);
1070+ }
10651071 }
10661072
10671073 if (gintsts & GINTSTS_WKUINT ) {
You can’t perform that action at this time.
0 commit comments