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.

This commit is contained in:
Louise Newberry 2016-02-13 11:35:44 +00:00
parent 268d9208b8
commit 20331cea64
1 changed files with 2 additions and 2 deletions

View File

@ -210,7 +210,7 @@ void __irq_usb_lp_can_rx0(void) {
#if (USB_ISR_MSK & USB_ISTR_WKUP)
if (istr & USB_ISTR_WKUP & USBLIB->irq_mask) {
USB_BASE->ISTR = ~USB_ISTR_WKUP;
USB_BASE->ISTR = ~(USB_ISTR_WKUP | USB_ISTR_SUSP);
usb_resume(RESUME_EXTERNAL);
}
#endif
@ -225,7 +225,7 @@ void __irq_usb_lp_can_rx0(void) {
usb_resume(RESUME_LATER);
}
/* clear of the ISTR bit must be done after setting of CNTR_FSUSP */
USB_BASE->ISTR = ~USB_ISTR_SUSP;
USB_BASE->ISTR = ~(USB_ISTR_WKUP | USB_ISTR_SUSP);
}
#endif