Check whether USB host is connected or not

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

Check whether USB host is connected or not

跳至解决方案
1,535 次查看
gianluca_panett
Contributor I

Hi,

I use a i.MX RT105x microcontroller with USB OTG configured as Virtual COM Port device.

How can I detect in my application whether my PC is connected to the uC or not?

Is there a way to read the state of the VBUS pin (without connecting it to a GPIO)?

Thanks.

标签 (1)
标记 (3)
1 解答
1,402 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Gianluca Panetta, 

I recommend you refer to the example dev_cdc_vcom_freertos from the SDK. In this example, we detect when the host is connected and configured with the following statements. 

if ((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions))


Have a great day,
Victor

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
1,403 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Gianluca Panetta, 

I recommend you refer to the example dev_cdc_vcom_freertos from the SDK. In this example, we detect when the host is connected and configured with the following statements. 

if ((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions))


Have a great day,
Victor

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------