Problem statement: I want my SAMD21 to wake on an RTC (match) interrupt or EXTIRQ button push, but it continues immediately from the __WFI statement.
My hunch is that there's a pending interrupt at the time I call __WFI, but I haven't been able to determine which one it is. Unwinding the ASF4 code, my setup goes like this:
// _set_sleep_mode to STANDBY SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // wait for interrupt __DSB(); __WFI(); // returns immediately without sleeping
What register(s) should I examine to see if there's a pending interrupt? As far as I can see, it's not the RTC.