Hi, can anyone explain to me about this example in this link with details : github.com/.../main.c I'm a newbie in nordic and i found it difficult to understand this example. Kindly assist and reply asap. Thanks!
Hi, can anyone explain to me about this example in this link with details : github.com/.../main.c I'm a newbie in nordic and i found it difficult to understand this example. Kindly assist and reply asap. Thanks!
With prescaler 0, the RTC will run at 32.768 KHz which means 32768 counts per second. This means that the CC[0] needs to be initialized and incremented with 32768 instead of 1000. I suggest that you read the Reference Manual chapter about RTC to get a better understanding of how it works.
What you mean is by putting NRF_RTC0->CC[0] = 32768 when NRF_RTC0->PRESCALER = 0 then the IRQ handler will trigger every 1s right? Nope, this is not working.
And NRF_RTC0->CC[0] = NRF_RTC0->COUNTER + 32768;
in the interrupt as the RTC is not reset unless it overflows.
Thanks Ole Bauck. What is the best way for me to set the timer to 100us accurately? By the way, If i wanted to change from RTC0 to RTC1 i just need to substitute all RTC0 to RTC1 only right?
You cannot get 100us accurately. Since the resolution of the RTC with prescaler 0 is 30.517us, the closest number would be 91.55us. To get 100us accurately, you have to use the TIMER peripheral that is able to run at 16MHz, however this will draw a lot more power (~250uA+ from crystal). To change to RTC1 susbstitute RTC0 by RTC1.