VBUS_DETECT on K20

cancel
Showing results for 
Search instead for 
Did you mean: 

VBUS_DETECT on K20

1,130 Views
zhj
Contributor I

I have a question as to how to use the VBUS_DETECT interrupt on K20.

We have got the USB device mode work on our K20 based board, but we don't want the USB module to be initialized and clocked until it is plugged into a host - in order to save power. Our device is self-powered.

To do that we need an interrupt to be triggered on being plugged into a host, so that we can then enable the USB clock, etc.

In K20's reference manual, it states "VBUS_detect: This interrupt pin connected to the USB VBUS signal detects when the device has been plugged into or unplugged from the USB bus. If the system requires waking up from a low power mode on being plugged into the USB port, this interrupt should also be a low power wake up source. If this pin multiplexes other functions, such as GPIO, the pin can be configured as an interrupt so that the USB plug or unplug event can be detected."

Does it mean we have to connect VBUS to a GPIO? VBUS_DETECT doesn't seem to belong to either USB controller or USB DCD module according to the figure below (Figure 42-8). How should the signal be used then?

We have VBUS connected to VREGIN at moment, will that help in any way? If it has to be connected to a GPIO to get the interrupt, is there any workaround without having to change H/W?

Also, the usb driver in MQX4.0 doesn't seem to be dealing with the VBUS sensing, is there a usb driver update somewhere or should I deinitialize the usb on unplug interrupt and reinitialize it on plug in interrupt by myself?

Many thanks,

Jian

0 Kudos
5 Replies

527 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

We recommend to use a GPIO pin as VBUS detection, which also could wake up the chip from all low power mode (includes LLS mode or VLLSx mode (using LLWU module with external pin)).

The VBUS connects to VERGIN and a GPIO pin doesn't cause conflict. I think customer can fly a wise to connect VBUS with related GPIO pin.

About MQX4.0, customer can refer low power mode example demo located at FSL MQX installation path: C:\Freescale\Freescale_MQX_4_0\mqx\examples\lowpower

Wish it helps.

Best regards,

Ma Hui

0 Kudos

527 Views
yinni
Contributor III

Hi Ma Hui,

I am working with MK50 and already have a GPIO connects to VBUS which also connects to VREGIN. But my problem is VREGIN is always stays HIGH, either 3.3V without USB connection or 5V with USB connected. The result is my GPIO reads HIGH all the time. Even if disable the USB regulator during board initialization I still got 2.9V at VREGIN.

I am thinking of adding a comparator to get HIGH with USB and LOW without USB, but is there any simpler way to solve the problem?

Many thanks in advance!

0 Kudos

527 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I think you can use a ADC channel to measure the voltage at VREGIN.

There need a resistor divide circuit and could add the power consumption.

It need to balance that design.

best regards,

Mike

527 Views
danieldelatorre
Contributor IV

You didn't really answer the question.

I'm facing a similar issue and I'm trying to figure out why my device won't enumerate.  At the moment I have a "self-powered" usb configuration and everywhere I read it states that we need to tie VBUS to a gpio but MQX's USB stack doesn't have anything like this anywhere in code.  I would have assumed that there is a configuration file where we can configure the VBUS_detect pin but I see nothing in the MQX source code. 

0 Kudos

527 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

So far, MQX software doesn't provide related feature(VBUS_detect) to USB stack.

Customer need to write related application code and define related macro at configuration file.


Wish it helps.

Best regards,
Ma Hui

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

0 Kudos