I'm having a problem with a Tiva C TM4C123 part that goes into deep sleep mode. It is running the USB stack and when there isn't much going on it goes into deep sleep. When it is busy it is running a timer and sampling and ADC. The problem I'm having is that it seems that there is something going on behind the scenes with USB that I"m not understanding.
When the device goes into deepsleep it shuts down the PLL and runs of the 16Mhz external oscillator. Therefore when the device goes to sleep I change the timer configuration from the one based on the 80Mhz PLL to the 16Mhz oscillator. When the timer wakes it up the system starts the PLL up again so I change the timer count to be based on the 80Mhz PLL. The issue is that there is something going on with the USB stack that wakes up the chip periodically and I can't figure out what it is. When I add this timer management to the callback RX/TX functions for USB it doesn't help much. If I don't connect the USB and trigger the device the timing is spot on. Is there a lower level interrupt routine in the USB stack that I can put my timer_reconfigure function in? I think the issue here is that the CPU is waking up to do some USB stuff at 80Mhz, but my timer is still set for the 16Mhz oscillator. I just can't figure out where to put my timer reconfigure function regarding USB.
Basically, when the device is plugged in via USB and the timer is set to wake up at 10Hz and toggle an LED it toggles it too fast. I'm setting my timer based on the 16Mhz oscillator when I go into sleep mode and when the timer wakes it up I reconfigure it for the PLL (80Mhz) when it's done I then change it back to be based on a 16Mhz clock etc..... When USB is plugged in the toggle rate is a little fast ~15Hz rather than the expected 10. When the device powers up off of a battery and I trigger it, it works perfect. If I plug in the USB cable then remove it my speed is too high. The only way the device works correctly is if the USB is never plugged in and the ARM comes out of powerup/reset NEVER seeing any USB connectivity.
Any Ideas?
Thanks,
Rob