Hi, Dialog
In my project, I need measure the time between GPIO interrupt HIGH to LOW and LOW to HIGH, the time is very short sometimes, like 0.1ms. So I can not use tick. To save power consumption, I want device stay in ext sleep, timer0 working in background and set GPIO to wake. Once GPIO interrupt trigger, I will read the timer0 count and record it.
Now the problem is timer0 was off during ext sleep by default. Can I set system to extsleep, but keep timer0 power on?
Thanks.
Best regards,
Brent Zheng
Device:
Hi brent_zheng,
Timers (0 and 2) are off when the device goes to sleep along with all the peripherals, the only option that you can have to enable a timer in extended sleep mode is the Kernel timer(app_easy_timer()). In this event you have to keep in mind that after the end of the timer the interrupt called and the BLE wakes up every time you do this procedure.
Thank you,
STS_Dialog.
Dear STS_Dialog,
Thank you for your quick reply.
Kernel timer can not meet my requirement because I need get time period less than one tick. Can I keep all all the peripherals on during ext sleep?
Thanks.
You can keep all the peripherals on, but in this case you have put your timer (0 or 2) to be updated by the LP clock. You can advise the datasheet of DA14585 (in documents tab in Datasheet section). In your scenario static inline void arch_turn_peripherals_off () function will work according to your implementation plan.
Thank you,
STS_Dialog.
Dear STS_Dialog,
But I got problem when try to enable all peripherals during ext sleep. I tried to change below in arch_turn_peripherals_off function:
// SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 1); // turn off peripheral power domain
SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 0);
Even no turn on timer(0 or 2), device will repeat reset during BLE advertise.
It's ok if I do not call arch_turn_peripherals_off in arch_goto_sleep, system can run normally. But it seems system do not entry ext sleep because SCB->SCR |= 1<<2; was set only in arch_turn_peripherals_off.
So could you please advice me how to modify SDK code, to enable app peripherals turn on during ext sleep?
Thanks.
Hi brent_zheng,
It would be better to not modify the core SDK code ,as this would possibly have additional issues which would require extensive testing.
Thanks,
STS_Dialog
Dear STS_Dialog,
It's very helpful for battery life if I can use timer0 with extend sleep mode. So could you please help me check it?
Thanks.
Best regards,
Brent Zheng
Hi,
We cannot support that use case right now for timer 0.
Please check the below link:
https://support.dialog-semiconductor.com/smarttag-ref-design-sleep-mode-...
Thanks,
STS_Dialog.