Skip to main content

How to keep RTC working in Deep Sleep mode

1 month ago

How to keep RTC working in Deep Sleep mode

Posted bybrent_zheng75 points 9 replies
0 upvotes

Dear Sir,

My product was using several times per day. So I want to put it into deep-sleep(RAM Off) and keep RTC counting once free.

问题是RTC日历/时间register was zero when system wakeup. I have already setup PD_TIM correctly.

Could you please help me to solve this problem, thank you very much!

1 month ago

PM_Dialog

Hi brent_zheng,

Thanks for your question online. I would recommend first checking the proximity reporter project from the SDK6.0.14 and our “Sleep modes” tutorial. Link is provided below :

http://lpccs-docs.dialog-semiconductor.com/DA14531_Sleep_Mode+/deepsleep_config.html

DA14531 is able to wake up from deep sleep mode via the RTC. Check our step #9 :

To wake up using RTC (Real Time Clock) timer, define CFG_DEEP_SLEEP_WAKEUP_RTC and undefine the rest of the wake-up mechanism.

Let us know if you still have any issue.

Thanks, PM_Dialog

1 month ago

brent_zheng 75 points

Dear Sir,

Thank you for your quickly answer. Yes I was using Prox-reporter project. When I defined CFG_DEEP_SLEEP_WAKEUP_RTC, the system can be wakeup in 10s later from Deep-sleep. But I question is how to keep RTC calendar/time register after wakeup. I called rtc_get_time_bcd() and the return is zero after system wakeup from deep-sleep.

Thanks.

1 month ago

brent_zheng 75 points

Dear Sir,

The register data before go to deep-sleep:

PMU_CTRL_REG:0
CLK_RTCDIV_REG:40c8
RTC_CONTROL_REG:0
RTC_EVENT_FLAGS_REG:0
RTC_TIME_REG:80000001
RTC_CALENDAR_REG:a021010d
RTC_KEEP_RTC_REG:1

After wakeup from deep-sleep by RTC_INTR_MIN event :

PMU_CTRL_REG:2
CLK_RTCDIV_REG:0
RTC_CONTROL_REG:0
RTC_EVENT_FLAGS_REG:0
RTC_TIME_REG:0
RTC_CALENDAR_REG:0
RTC_KEEP_RTC_REG:0

It seems RTC was working durning deep-sleep, but some one clear or reset those register in wakeup procedure. Could you please help me check it?

Thanks.

1 month ago

PM_Dialog

Hi brent_zheng,

Apologies for the delay. Let me check this and I'll get back to you ASAP.

Thanks, PM_Dialog

1 month ago

PM_Dialog

Hi brent_zheng,

If you would like to keep the RTC values when the DA14531 wakes-up, you should use the extended sleep mode. In this mode, all the RAM blocks are retained (default configuration), so the registers are not reset.

When the DA14531 wakes up, the application code will start executing immediately and no data will be lost.

The SDK6.0.14.1114 provides 2 examples to understand how to use the extended sleep mode and how to wake-up the DA4531 too.

projects\target_apps\ble_examples\prox_reporter\Keil_5

projects\target_apps\ble_examples\ble_app_sleepmode\Keil_5

Thanks, PM_Dialog

1 month ago

brent_zheng 75 points

Dear Sir,

Yes, I know extend sleep can be used. My concern is why RTC can work during deep-sleep, but cleared when wakeup? Because RAM did not be retained? I also tried deep-sleep with RAM retained, seems does not work.

BR,

Brent

accepted answer!

1 month ago

PM_Dialog

Hi brent_zheng,

Please check the arch_set_deep_sleep() API. After entering the deep sleep mode and the code reaches to WFI(), a HW reset should be performed on the wake-up. In line 122, the PMU_CTRL_REG[RESET_ON_WAKEUP] is set to 1, so an HW is activated on wake up according toDA14531 Datasheet(v3.3), section 5.2.1 POR, HW, and SW Reset

In Table 39: Reset Signals and Registers, the RTC regs are reset by POR or HW reset. So, from Deep sleep to wake-up mechanism goes through an HW reset process therefore it will copy software from OTP or the secondary memory. Due to this reason, ram data will be overwritten and RTC will start counting from zero again.

Thanks, PM_Dialog

4 weeks ago

brent_zheng 75 points

Ok, I've got it, thank you very much!

4 weeks ago

PM_Dialog

Hi brent_zheng,

Thanks for accepting my answer. If you have any follow up question, please raise a new forum ticket.

Thanks, PM_Dialog