SNVS_RTC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SNVS_RTC

2,325 次查看
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

标签 (1)
0 项奖励
回复
3 回复数

2,254 次查看
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 项奖励
回复

2,301 次查看
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 项奖励
回复

2,291 次查看
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 项奖励
回复