Hello,
I am using the NRF52-DK softdevice 6.0.0 and NRF SDK 15.0.
The app is based on on the ble_app_template PCA10040e S112 (The final chip will be a NRF52810 that's why I use the PCA10040e.)
My goal is to keep a non discontinued reference time.
I do not need a high precision (briefly a second) and as I only want to keep track the seconds elapsed. (until the run out of the battery which should be 15 days)
I want to use the external crystal 32Khz to get the 20ppm precision drift which should be already setup by default in the ble_app_template. (Is that right?)
On the NRF52810 there is 2 RTC:
- One is used for softdevice (RTC0)
- The other one (RTC1) with other app features such as App_timer, App_Button and have some links with the ble (cf:ble_conn_params_init).
My idea is to plug my need by editing the app_timer file and using the RTC1 .
I first define APP_TIMER_KEEPS_RTC_ACTIVE to 1 in order to keep RTC alive.
I tried several solutions by paying attention to NRF_RTC1->TASKS_CLEAR, reading every time the NRF_RTC1->COUNTER in the main for (;;) but I am not sure to have defined the good/working solution and with keeping in mind a low power current consumption.
How can I do to make my counter running and increasing over the time (with the overflow of NRF_RTC1->COUNTER and the NRF_RTC1->TASKS_CLEAR events of the times which could occurred) while paying attention to not disturb the timer feature processing and keep a low power current consumption ?
An other idea will the use of a PWM at 1HH but not sure to know if it is a good idea in term of current consumption and for the precision and drift of the PWM. (Although I would also need 2 more PWM for later use in my app)
Thanks in advance for your help.