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?