Hi Michael,
The K20_120MHz product provides two USB modules, one is USB high speed module, the other one is USB Full/Low speed module.
For the USB high speed module, there with USB Command Register (USBHS_USBCMD) [RS] bit, clear this bit causes a detach event:
Device mode:
Setting this bit causes the controller to enable a pull-up on DP and initiate an attach event. This control bit is not directly connected to the pull-up enable, as the pull-up becomes disabled upon transitioning into high-speed mode. Software must use this bit to prevent an attach event before the USBHS controller has properly initialized. Clearing this bit causes a detach event.
For USB FS/LS module, USB module works as device mode with D+ pull up enabled. So, disable the D+ Pull Up at the USB transceiver as a detach event. Customer can clear USB OTG Control Register (USBx_CONTROL) [DPPULLUPNONOTG] bit.
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------