How to enter suspend mode in i.MX RT1064

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

How to enter suspend mode in i.MX RT1064

1,958 Views
wpneu
Contributor I
Dears, We use rt1064 board, and want to enter low power mode, refer to chapter 12(CCM) Table 12-2(STOP mode configuration), we only configured the PMU register PMU_MISC0[STOP_MODE_CONFIG] bit as the doc mentioned , but it's not work enter to suspend mode, the led is still blink. please help me to veryfied how to enter the suspend. thanks very much. the code: base->MISC0 = PMU_MISC0_SET_STOP_MODE_CONFIG(0)
0 Kudos
Reply
6 Replies

1,957 Views
wpneu
Contributor I

attachmentlp mode.pnglp.png

0 Kudos
Reply

1,951 Views
fangfang
NXP TechSupport
NXP TechSupport

Hello,

Please refer to the detail information as the  application note AN12085.

https://www.nxp.com.cn/docs/en/application-note/AN12085.pdf.

Hope it help you. Have a nice day.

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------

0 Kudos
Reply

1,945 Views
wpneu
Contributor I

Hello,

thanks so much for your guide, now I use  the below source code ,and can enter snvs mode,aslo can wake up by the button pin (IOMUXC_SNVS_WAKEUP_GPIO5_IO00) 。

void set_snvs_mode(void)
{

          CLOCK_EnableClock(kCLOCK_SnvsHp);
          SNVS->LPCR |= SNVS_LPCR_DP_EN_MASK;
          SNVS->LPCR |= SNVS_LPCR_TOP_MASK;
          while (1) /* Shutdown */
          {

          }

}

but there is another question , as the guide mentioned , it aslo can wake up by rtc , does it means the rtc is still alive to count after enter to snvs mode?  if it is true , after I set the rtc time to 2020-12-08 18:30:00, and enter to snvs mode, after a while, I use the button to wake up the system, the rtc time should be still alive to count.   but actually, after wake up ,  I execute the date command, the rtc time reset to 1970:00:00:00 .  so, does the snvs mode can not let rtc module alive?  if this, how can use rtc alarm to wake up the snvs mode(becase rtc is dead)?   thanks for your reply.

this is my test:

 

msh />date 2020 12 08 18 49 30

msh />date
Tue Dec 8 18:49:33 2020

msh /> set_snvs_mode

enter to snvs mode....

================

after press wake up button:

sram heap, begin: 0x200146b0, end: 0x20020000

\ | /
- RT - Thread Operating System
/ | \ 4.0.1 build Dec 8 2020
2006 - 2019 Copyright by rt-thread team
[I/[FLEXSPI]] NorFlash Init
[I/[FLEXSPI]] Vendor ID: 0x15
[I/[FLEXSPI]] NorFlash Init Done

msh />date
Thu Jan 1 00:00:13 1970    ===========> the rtc reset to 1970 .

 

 

 

0 Kudos
Reply

1,932 Views
fangfang
NXP TechSupport
NXP TechSupport

Hello,

>> does it means the rtc is still alive to count after enter to snvs mode?

Yes. It is correct. The RTC that can be used to wake up the chip from power down is the SRTC, secure RTC from the SNVS_LP power domain.
The information related to this part and the bits that you need to set is in the Secure Reference Manual. Unfortunately, We cannot share this Reference Manual as long as you need to request access to it in our web page.

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------

0 Kudos
Reply

1,912 Views
wpneu
Contributor I

thanks to for your info .

now i want to use the srtc to wakeup the system form snvs mode.  so I test the srtc 's alarm function.

I use the evkmimxrt1064\driver_examples\snvs\snvs_lp_srtc examples and change the HP rtc alarm to LP srtc alarm to test it.

 

the code as below:

 


#define kCLOCK_SnvsLp0 kCLOCK_SnvsLp
#define EXAMPLE_SNVS_SRTC_IRQn SNVS_LP_WRAPPER_IRQn
#define EXAMPLE_SNVS_SRTC_IRQHandler SNVS_LP_WRAPPER_IRQHandler


void EXAMPLE_SNVS_SRTC_IRQHandler(void)
{
rt_kprintf("srtc irq\n");
if (SNVS_LP_SRTC_GetStatusFlags(SNVS) & kSNVS_SRTC_AlarmInterruptFlag)
{
busyWait = false;

/* Clear alarm flag */
SNVS_LP_SRTC_ClearStatusFlags(SNVS, kSNVS_SRTC_AlarmInterruptFlag);
}

}

void srtc_test(void)
{
uint32_t sec;
uint32_t min;
uint32_t hour;
uint8_t index;

snvs_lp_srtc_datetime_t srtcDate;

snvs_lp_srtc_config_t snvsSrtcConfig;

/* Board pin, clock, debug console init */
/* Init SNVS_HP */
/*
* config->rtcCalEnable = false;
* config->rtcCalValue = 0U;
* config->periodicInterruptFreq = 0U;
*/

CLOCK_EnableClock(kCLOCK_SnvsLp);

SNVS_LP_SRTC_GetDefaultConfig(&snvsSrtcConfig);
SNVS_LP_SRTC_Init(SNVS, &snvsSrtcConfig);

rt_kprintf("SNVS LP SRTC example:\r\n");

/* Set a start date time and start RT */
srtcDate.year = 2019U;
srtcDate.month = 12U;
srtcDate.day = 25U;
srtcDate.hour = 12U;
srtcDate.minute = 0;
srtcDate.second = 0;

/* Set SRTC time to default time and date and start the SRTC */
SNVS_LP_SRTC_SetDatetime(SNVS, &srtcDate);
SNVS_LP_SRTC_StartTimer(SNVS);

 

rt_kprintf("SRTC date and time has been synchronized with SRTC\r\n");

/* Enable SNVS alarm interrupt */
SNVS_LP_SRTC_EnableInterrupts(SNVS, kSNVS_SRTC_AlarmInterrupt);

/* Enable at the NVIC */
EnableIRQ(EXAMPLE_SNVS_SRTC_IRQn);

rt_kprintf("Set up time to wake up an alarm.\r\n");


/* Get date time */
SNVS_LP_SRTC_GetDatetime(SNVS, &srtcDate);

/* print default time */
rt_kprintf("Current srtc datetime: %04hd-%02hd-%02hd %02hd:%02hd:%02hd\r\n", srtcDate.year, srtcDate.month, srtcDate.day,
srtcDate.hour, srtcDate.minute, srtcDate.second);


sec = 20; //test 20sec to alarm

/* Alarm can be set only for one day*/
if (sec > (24 * 60 * 60))
{
rt_kprintf("Please input the number below 86000 and press enter \r\n");
//continue;
}
SNVS_LP_SRTC_GetDatetime(SNVS, &srtcDate);
if ((srtcDate.second + sec) < 60)
{
srtcDate.second += sec;
}
else
{
min += (srtcDate.second + sec) / 60U;
srtcDate.second = (srtcDate.second + sec) % 60U;
}

if ((srtcDate.minute + min) < 60)
{
srtcDate.minute += min;
}
else
{
srtcDate.hour += (srtcDate.minute + min) / 60U;
srtcDate.minute = (srtcDate.minute + min) % 60U;
}

if ((srtcDate.hour + hour) < 24)
{
srtcDate.hour += hour;
}
else
{
srtcDate.day += (srtcDate.hour + hour) / 24U;
srtcDate.hour = (srtcDate.hour + hour) % 24U;
}

SNVS_LP_SRTC_SetAlarm(SNVS, &srtcDate);

/* Get alarm time */
SNVS_LP_SRTC_GetAlarm(SNVS, &srtcDate);

/* Print alarm time */
rt_kprintf("srtc Alarm will occur at: %04hd-%02hd-%02hd %02hd:%02hd:%02hd\r\n", srtcDate.year, srtcDate.month, srtcDate.day,
srtcDate.hour, srtcDate.minute, srtcDate.second);

}

I set 20secs to the srtc alarm , and wait to the alarm trigger and call the interrupt handler (EXAMPLE_SNVS_SRTC_IRQHandler ), but there is no event to trigger the interrupt handler. it seems the srtc alarm is not worked.   is there somthing wrong i configured the srtc ? thanks for your replay.

 

 

0 Kudos
Reply

1,926 Views
wpneu
Contributor I

thanks,

 Should i use the fsl_snvs_lp.c module's interface to set the rtc time and then i can use the rtc to save time to alarm the system from snvs mode ? thanks .

0 Kudos
Reply