How to detect a USB cable was connected to my device?

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

How to detect a USB cable was connected to my device?

Jump to solution
821 Views
eliiser
Contributor I

We're using a K60 with our own HW, but it applies to TOWER boards as well. We are working as a device only, and the computer is the host, with a CDC driver.

How to detect that a USB cable has been connected to the device? The other side can either be a computer or a charger. With a computer on the other end it's fairly simple - there are various interrupts and messages sent to the USB stack which we can use.

But when connecting to a USB charger (a simple power supply with a USB jack) we only see a SLEEP interrupt and no message (which is to be expected). From the description of the SLEEP interrupt (in USB0_ISTAT) it doesn't look like it's the correct way to identify USB connection.

Is there some other interrupt/register that can tell us only that the USB cable is connected to something?

Labels (2)
0 Kudos
1 Solution
513 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Eli:

For this purpose you have to connect VBUS line to a 5V tolerant GPIO pin and use that pin to detect when a Host cable is connected to your device. This is because K60 does not have an active register that indicates when VBUS is present.


Regards!,
Jorge Gonzalez

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

View solution in original post

0 Kudos
2 Replies
514 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Eli:

For this purpose you have to connect VBUS line to a 5V tolerant GPIO pin and use that pin to detect when a Host cable is connected to your device. This is because K60 does not have an active register that indicates when VBUS is present.


Regards!,
Jorge Gonzalez

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

0 Kudos
513 Views
eliiser
Contributor I

Hello Jorge,

Thank you very much for the reply!

0 Kudos