I am running the power_manager demo available with the FRDM-K32L2B3 demo board. Following wake from Normal STOP mode, I see that the SMC_PMCTRL[STOPA] bit is set. From the Reference Manual, this should only occur if entry into STOP mode was prevented by an interrupt:
When set, this read-only status bit indicates an interrupt occured during the previous stop mode entry sequence, preventing the system from entering that mode. This field is cleared by reset or by hardware at the beginning of any stop mode entry sequence and is set if the sequence was aborted.
However, I have found that the bit is set after a successful entry into STOP and subsequent wake from STOP back to RUN.
Is this a bug with the hardware? Or perhaps a bug in the fsl_smc SMC_SetPowerModeStop() method?
OK. Good to know. Since the documentation explicitly states otherwise, it should be updated to reflect the actual operation.
Can you offer an alternative for detecting an aborted stop mode entry sequence? It would be useful to know, so that the code execution can simply try again to enter stop mode.