Skip to content

Commit 20331ce

Browse files
committed
Make sure both USB_ISTR_SUSP & USB_ISTR_WKUP are both cleared when USB susppends or resumes. This is required as when we see a suspend event it looks like we immediately afterwords trigger a resume from the bit being set previously.
1 parent 268d920 commit 20331ce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • STM32F1/cores/maple/libmaple/usb/stm32f1

STM32F1/cores/maple/libmaple/usb/stm32f1/usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void __irq_usb_lp_can_rx0(void) {
210210

211211
#if (USB_ISR_MSK & USB_ISTR_WKUP)
212212
if (istr & USB_ISTR_WKUP & USBLIB->irq_mask) {
213-
USB_BASE->ISTR = ~USB_ISTR_WKUP;
213+
USB_BASE->ISTR = ~(USB_ISTR_WKUP | USB_ISTR_SUSP);
214214
usb_resume(RESUME_EXTERNAL);
215215
}
216216
#endif
@@ -225,7 +225,7 @@ void __irq_usb_lp_can_rx0(void) {
225225
usb_resume(RESUME_LATER);
226226
}
227227
/* clear of the ISTR bit must be done after setting of CNTR_FSUSP */
228-
USB_BASE->ISTR = ~USB_ISTR_SUSP;
228+
USB_BASE->ISTR = ~(USB_ISTR_WKUP | USB_ISTR_SUSP);
229229
}
230230
#endif
231231

0 commit comments

Comments
 (0)