Re: USB_CDC console generated code misuse of USB_DEVICE_ATTACH function ??
This is microchip's reply on the case:
The USB specifications require that USB peripherals not source current on D+ or D- when the host/hub is not actively powering the Vbus line. A self powered USB Device firmware should make sure that it does not turn on D+or D- pull up resistor unless Vbus is actively powered. Harmony USB Device stack generates the event USB_DEVICE_EVENT_POWER_DETECTED when VBUS is active.
What are the consequences of calling USB_DEVICE_Attach before detecting a physical connection to the host? and what are the consequences of not calling the USB_DEVICE_Detach when the host is disconnected?
The answer to both the questions above are same. This is USB spec violation and the Device would fail USB compliance tests.