Setting the value of timer peripheral while running

Hi,

In the product specification document of nRF52840 it says that  in order to read the counter register's value I need to set the capture task  NRF_TIMER1->TASKS_CAPTURE = 1 and then I can read the timer ticks value from the corresponding CC[n]. Register. I managed to do that but  how can I do the opposite ?

How can I change the TIMER1 counter register value  while it is running  by loading it with another value since there is no such register access ?
For example if the counter register of TIMER1 has the value 0x11FFFFFF how can I change it to 0x22FFFFFF? Is it possible by assigning that value to the corresponding CC[n] register?

Parents Reply
  • I need to keep timestamps for my raw data. For this reason I have an external RTC module and the internal msec timer (TIMER1). The problem is that they come out of sync every once in a while. So I need to add subtract from the msec timer to keep RTC and Timer1 in sync.

    I could use events for this but I need the microcontroller to be in sleep mode most of the time  and wake up only in certain cases.

    Thank you for your help

Children
Related