diff --git a/targets/TARGET_Freescale/usb/USBPhy_Kinetis.cpp b/targets/TARGET_Freescale/usb/USBPhy_Kinetis.cpp index 60ad7d7f1f..84c50d94b6 100644 --- a/targets/TARGET_Freescale/usb/USBPhy_Kinetis.cpp +++ b/targets/TARGET_Freescale/usb/USBPhy_Kinetis.cpp @@ -195,6 +195,10 @@ void USBPhyHw::connect() void USBPhyHw::disconnect() { + // disable all endpoints to prevent them from nacking when disconnected + for(int i = 0; i < 16; i++) { + USB0->ENDPOINT[i].ENDPT = 0x00; + } // disable USB USB0->CTL &= ~USB_CTL_USBENSOFEN_MASK; // Pull up disable