Hi,
I'm working with the iMX RT1171 and shutting down the system by setting the Turn Off System Power (TOP) bit in the SNVS LPCR register. Before setting this bit, I configure the SRTC alarm using SNVS_LP_SRTC_SetAlarm() to trigger after 10 seconds.
My expectation is that the device will wake up 10 seconds after power-off via the SRTC alarm, once the LPCR.TOP bit is set. However, the device never wakes up the SRTC alarm does not bring it back from SNVS sleep.
What should I do to make sure the device can wake up via the SRTC alarm?
Here’s a representative code snippet:
(In the actual implementation, proper rollover checks are performed for date and time values. The sample code above omits these for simplicity.)
snvs_lp_srtc_config_t lp_srtc_config = {0U};
SNVS_LP_SRTC_GetDefaultConfig(&lp_srtc_config);
SNVS_LP_SRTC_Init(SNVS, &lp_srtc_config);
SNVS_LP_SRTC_StartTimer(SNVS);
snvs_lp_srtc_datetime_t srtc_datetime = {0};
SNVS_LP_SRTC_GetDatetime(SNVS, &srtc_datetime);
SNVS_LP_SRTC_ClearStatusFlags(SNVS, kSNVS_SRTC_AlarmInterruptFlag);
SNVS_LP_SRTC_EnableInterrupts(SNVS, kSNVS_SRTC_AlarmInterrupt);
srtc_datetime.second += 10;
status_t ret_val = SNVS_LP_SRTC_SetAlarm(SNVS, &srtc_datetime);
if (kStatus_Success != ret_val)
{
/// log
}
__DSB();
__ISB();
SNVS->LPCR |= SNVS_LPCR_TOP_MASK;