Check whether USB host is connected or not

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check whether USB host is connected or not

Jump to solution
1,005 Views
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.

Labels (1)
Tags (3)
1 Solution
872 Views
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.
-------------------------------------------------------------------------------

View solution in original post

1 Reply
873 Views
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.
-------------------------------------------------------------------------------