We have a problem that occurs occasionally on a SAM R21 when it comes out of sleep mode. We have it waking every 5 minutes and sending a packet. After some period of operation from hours, to weeks the SAM R21 will go into some strange state on wakeup. When it goes into this state, it does not send a packet and never goes back to sleep, just continues to run and burn power (until the battery dies).
We are using a SAM-ICE to flash it, but we can not use it to debug wakeup because the debugger exits as soon as the SAM R21 goes to sleep.
Is there some way that we can prevent the debugger from exiting when the SAM R21 sleeps so that we can catch what it is doing differently when it wakes?