iMXRT1171 - Waking Up from SNVS Sleep Using SNVS SRTC Alarm

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMXRT1171 - Waking Up from SNVS Sleep Using SNVS SRTC Alarm

Jump to solution
365 Views
BRK_Y
Contributor III

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;

 

1 Solution
195 Views
BRK_Y
Contributor III

After configuring the SRTC, adding a short delay block resolved the issue.

View solution in original post

0 Kudos
Reply
3 Replies
196 Views
BRK_Y
Contributor III

After configuring the SRTC, adding a short delay block resolved the issue.

0 Kudos
Reply
243 Views
Habib_MS
NXP Employee
NXP Employee

Hello @BRK_Y,

Low power management on the RT1170 is a bit more complex. It is possible to wake up the device through the RTC, which is controlled by the SNVS module.
For more detailed information about low power modes, you can refer to this app note that explains these modes in depth, along with all the considerations required to enter low power states.
Additionally, the SDK (version 25.09) provides examples demonstrating the use of power modes, depending on the power source you are currently using, as shown in the following image:

Habib_MS_0-1761169260184.png

I highly recommend reviewing the README file included with these examples to understand how they work.

BR
Habib

0 Kudos
Reply
194 Views
BRK_Y
Contributor III
I need help with another topic. I want to manually control the PMIC_ON_REQ pin, so I’m trying to use the PK_OVERRIDE and PK_EN bits in SNVS->LPCR.

I set the PK_OVERRIDE bit to disable automatic control of the PMIC_ON_REQ pin. Then, I attempted to drive the pin high/low using the PK_EN bit. However, it didn’t work as expected.

Is there a way to manually control the PMIC_ON_REQ pin?
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2186606%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EiMXRT1171%20-%20Waking%20Up%20from%20SNVS%20Sleep%20Using%20SNVS%20SRTC%20Alarm%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186606%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI'm%20working%20with%20the%20iMX%20RT1171%20and%20shutting%20down%20the%20system%20by%20setting%20the%20Turn%20Off%20System%20Power%20(TOP)%20bit%20in%20the%20SNVS%20LPCR%20register.%20Before%20setting%20this%20bit%2C%20I%20configure%20the%20SRTC%20alarm%20using%20SNVS_LP_SRTC_SetAlarm()%20to%20trigger%20after%2010%20seconds.%3C%2FP%3E%3CP%3EMy%20expectation%20is%20that%20the%20device%20will%20wake%20up%2010%20seconds%20after%20power-off%20via%20the%20SRTC%20alarm%2C%20once%20the%20LPCR.TOP%20bit%20is%20set.%20However%2C%20the%20device%20never%20wakes%20up%20the%20SRTC%20alarm%20does%20not%20bring%20it%20back%20from%20SNVS%20sleep.%3C%2FP%3E%3CP%3EWhat%20should%20I%20do%20to%20make%20sure%20the%20device%20can%20wake%20up%20via%20the%20SRTC%20alarm%3F%3C%2FP%3E%3CP%3EHere%E2%80%99s%20a%20representative%20code%20snippet%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3EIn%20the%20actual%20implementation%2C%20proper%20rollover%20checks%20are%20performed%20for%20date%20and%20time%20values.%20The%20sample%20code%20above%20omits%20these%20for%20simplicity.%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Esnvs_lp_srtc_config_t%20lp_srtc_config%20%3D%20%7B0U%7D%3B%0A%0ASNVS_LP_SRTC_GetDefaultConfig(%26amp%3Blp_srtc_config)%3B%0ASNVS_LP_SRTC_Init(SNVS%2C%20%26amp%3Blp_srtc_config)%3B%0ASNVS_LP_SRTC_StartTimer(SNVS)%3B%0A%0Asnvs_lp_srtc_datetime_t%20srtc_datetime%20%3D%20%7B0%7D%3B%0ASNVS_LP_SRTC_GetDatetime(SNVS%2C%20%26amp%3Bsrtc_datetime)%3B%0A%0ASNVS_LP_SRTC_ClearStatusFlags(SNVS%2C%20kSNVS_SRTC_AlarmInterruptFlag)%3B%0ASNVS_LP_SRTC_EnableInterrupts(SNVS%2C%20kSNVS_SRTC_AlarmInterrupt)%3B%0A%0Asrtc_datetime.second%20%2B%3D%2010%3B%0A%0Astatus_t%20ret_val%20%3D%20SNVS_LP_SRTC_SetAlarm(SNVS%2C%20%26amp%3Bsrtc_datetime)%3B%0Aif%20(kStatus_Success%20!%3D%20ret_val)%0A%7B%0A%20%20%20%20%2F%2F%2F%20log%0A%7D%0A%0A__DSB()%3B%0A__ISB()%3B%0A%0ASNVS-%26gt%3BLPCR%20%7C%3D%20SNVS_LPCR_TOP_MASK%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2194178%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20iMXRT1171%20-%20Waking%20Up%20from%20SNVS%20Sleep%20Using%20SNVS%20SRTC%20Alarm%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2194178%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EI%20need%20help%20with%20another%20topic.%20I%20want%20to%20manually%20control%20the%20PMIC_ON_REQ%20pin%2C%20so%20I%E2%80%99m%20trying%20to%20use%20the%20PK_OVERRIDE%20and%20PK_EN%20bits%20in%20SNVS-%26gt%3BLPCR.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20set%20the%20PK_OVERRIDE%20bit%20to%20disable%20automatic%20control%20of%20the%20PMIC_ON_REQ%20pin.%20Then%2C%20I%20attempted%20to%20drive%20the%20pin%20high%2Flow%20using%20the%20PK_EN%20bit.%20However%2C%20it%20didn%E2%80%99t%20work%20as%20expected.%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20a%20way%20to%20manually%20control%20the%20PMIC_ON_REQ%20pin%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2194174%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20iMXRT1171%20-%20Waking%20Up%20from%20SNVS%20Sleep%20Using%20SNVS%20SRTC%20Alarm%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2194174%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAfter%20configuring%20the%20SRTC%2C%20adding%20a%20short%20delay%20block%20resolved%20the%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2191009%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20iMXRT1171%20-%20Waking%20Up%20from%20SNVS%20Sleep%20Using%20SNVS%20SRTC%20Alarm%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2191009%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F210673%22%20target%3D%22_blank%22%3E%40BRK_Y%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3ELow%20power%20management%20on%20the%20RT1170%20is%20a%20bit%20more%20complex.%20It%20is%20possible%20to%20wake%20up%20the%20device%20through%20the%20RTC%2C%20which%20is%20controlled%20by%20the%20SNVS%20module.%3CBR%20%2F%3EFor%20more%20detailed%20information%20about%20low%20power%20modes%2C%20you%20can%20refer%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN13148.pdf%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eapp%20note%3C%2FA%3E%20that%20explains%20these%20modes%20in%20depth%2C%20along%20with%20all%20the%20considerations%20required%20to%20enter%20low%20power%20states.%3CBR%20%2F%3EAdditionally%2C%20the%20SDK%20(version%2025.09)%20provides%20examples%20demonstrating%20the%20use%20of%20power%20modes%2C%20depending%20on%20the%20power%20source%20you%20are%20currently%20using%2C%20as%20shown%20in%20the%20following%20image%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Habib_MS_0-1761169260184.png%22%20style%3D%22width%3A%20587px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Habib_MS_0-1761169260184.png%22%20style%3D%22width%3A%20587px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362173i8B423E04794F07E9%2Fimage-dimensions%2F587x459%3Fv%3Dv2%22%20width%3D%22587%22%20height%3D%22459%22%20role%3D%22button%22%20title%3D%22Habib_MS_0-1761169260184.png%22%20alt%3D%22Habib_MS_0-1761169260184.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI%20highly%20recommend%20reviewing%20the%20README%20file%20included%20with%20these%20examples%20to%20understand%20how%20they%20work.%3C%2FP%3E%0A%3CP%3EBR%3CBR%20%2F%3EHabib%3C%2FP%3E%3C%2FLINGO-BODY%3E