SNVS_RTC

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

SNVS_RTC

2,326 Views
Punithintelli
Contributor I

Hi I am using i.MX RT 1020 MIMXRT1020 EVK kit. 

I am using the power_mode_switch_bm example code to enter SNVS mode and come out after couple of seconds. This works perfectly fine.

But when I try to configure the RTC and use the same example code after every SNVS Mode entering and coming out the RTC resets. This is happening because before setting the alarm to wake up 
SNVS->LPSRTCMR = 0x00;
SNVS->LPSRTCLR = 0x00; is made zero. These 2 registers are date and time counter. If i comment this 2 lines the MCU will not come out of SNVS mode.

Could anybody give me a solution where in the RTC works in SNVS mode also?

Thanks

Labels (1)
0 Kudos
Reply
3 Replies

2,255 Views
lucas_cao
NXP Employee
NXP Employee

Hi

I think you are using the Time alarm interrupt as the wake up source.

This is intterrupt is gennerated when 【LPSRTCMR + LPSRTCLR】bit[46:15] = TA.

Besides this, this counter is a up counter. So that, if you didn't clear the LPSRTCMR and LPSRTCLR, the interrupt will no be generated becasuse 【LPSRTCMR + LPSRTCLR】bit[46:15] is bigger than TA.

So that, i think your can using the following code as a reference:

unit64_t time = (SNVS->LPSRTCMR)<<32 + SNVS->LPSRTCLR;

time = time / 32k;

SNVS->LPTAR = time + your new wake up time in second.

Please have a try.

0 Kudos
Reply

2,302 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @Punithintelli,

Please refer to the "snvs_lp_srtc" example code from the SDK for the correct usage of the RTC in SNVS domain.

0 Kudos
Reply

2,292 Views
Punithintelli
Contributor I

Hi @EdwinHz ,

I am using snvs_lp_srtc for RTC configuration and power_mode_switch_bm for entering SNVS mode.

After coming out of snvs mode the RTC gets reset.

This is because  SNVS->LPSRTCMR = 0x00;
                           SNVS->LPSRTCLR = 0x00; these 2 registers are mapped to zero before entering the snvs mode. These 2 registers holds the date and time.

 

0 Kudos
Reply