Skip to content

Commit 231fa71

Browse files
c1728p90xc0170
authored andcommitted
Prevent Kinetis USB setup packets at wrong time
When disconnecting USB clear all pending interrupts. This ensures that pending setup packets are dropped rather than being triggered after disconnect.
1 parent c4c0749 commit 231fa71

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

usb/device/targets/TARGET_Freescale/USBPhy_Kinetis.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ void USBPhyHw::disconnect()
203203
USB0->CTL &= ~USB_CTL_USBENSOFEN_MASK;
204204
// Pull up disable
205205
USB0->CONTROL &= ~USB_CONTROL_DPPULLUPNONOTG_MASK;
206+
207+
while (USB0->ISTAT) {
208+
USB0->ISTAT = 0xFF;
209+
}
206210
}
207211

208212
void USBPhyHw::configure()

0 commit comments

Comments
 (0)