I have a bootloader and application running on a K20. When the processor boots it initializes the USB peripheral as a CDC bulk device and then waits 1500ms to see if it enumerates. If it doesn't enumerate I set a flag to boot the application and forget all about USB until the user cycles power.
This worked great until we buried the device in a vehicles engine compartment and connected it directly to the battery. Now its not so easy to cycle power.
So I'm looking for a minimal way to sense the bus is active from the application and reset the processor. I had hoped that I could...
enable the USB clock in the SCG
enable USB interrupts in the NVIC
enable USB in the USB0_CTL
enable the AVBUSEN interrupt in the USB0_OTGICR
and reset the processor in the ISR. However, I'm not getting any interrupts.
Am I on the right path? Is there a better way to do this? The goal here is to either fix it in software or come up with a good argument for a new board revision. I really think this is doable in software without setting up the USB peripheral as a bulk device