I'm trying to use app_timer_cnt_get()
to implement an RTC Calendar system on a Gigawit module (nRF51822).
I have a test app_timer
that has presacler=0 and period=3 seconds. The callback works as I toggle a LED, and it toggles every 3 seconds.
The code uint32_t this_count = app_timer_cnt_get();
shows a value of 0x00018000
when I set a breakpoint after the call to app_timer_cnt_get().
Why does it not increment? RTC1
and the timer is obviously working and counting, and app_timer_cnt_get()
eventually return NRF_RTC1->COUNTER;
Is the counter automatically reset to zero? I can't imagine so if multiple timers are used with APP_TIMER
.
I've tried enabling RTC1
in sdk_config.h
, but app_timer was working without that anyway.
I've also tried enabling APP_TIMER_KEEPS_RTC_ACTIVE
in sdk_config.h
. I think I need this anyway for my Calendar implementation (for log timestamps), however it didn't make any difference.
Any help or suggestions greatly appreciated !!
Brendan.