Close USB Connection Before Software Reset

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Close USB Connection Before Software Reset

1,505 次查看
Mike_d
Contributor IV

I'm having issues with the host PC's virtual COM port getting hung up when the K20 performs a software reset.  So my question is:  What can I do to gracefully close the USB session prior to the software reset?

标签 (1)
2 回复数

1,272 次查看
crezyoz
Contributor IV

Michael. If you are using COM ports, there really is no way to survive an unintentional disconnect. The port disappears from Windows Device list and from what I cold find, after a long time working with this problem, there is no way to solve the problem. As soon as the port is turned off or removed, the COM port code in your app will hang. It isn't even around for you to attempt to close it.

0 项奖励
回复

1,272 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------