I need to be able to actively set the value being incremented in the Timer2 register on the nrf52 (what I believe would be it's main register). It seems that this might be possible. Is it? If so, how do I do this? Otherwise, is there another way that I can have a very reliable timer with which I can adjust? Is the solution just to have a volatile variable that gets updated every ms with an interrupt (I just realized this isn't going to work because the softdevice is going to delay this interrupt). If an external timer or some kind of settable counter IC is the only option, I'll have to take that route. Also is systick an option, it looks like it can be set but it decrements. If I try to go the interrupt route with it, the softdevice will still likely get in the way, correct?
UPDATE:
I have found: devzone.nordicsemi.com/.../
I looked at the code and it's pretty clever how it lets the timer run to the offset and eventually corrects.
I have the daunting task of attempting to synchronize with iPhones uptime timer. I don't need it to be in sync for very long, just enough time for a task to start on each device at the same time. My approach is to chop off the upper half of the uint64_t off and sent that across from iphone. I've got an algorithm that compensates for both offset and drift. I know this will never be 100% dead on, but I really would like to see millisecond accuracy for if only a minute (Which is all i need). I suppose my last question is should I, or can I do this in a time slot. iPhone only allows BLE, and the example uses something else.
I just realized there is a problem since the iphones timer will not be overflowing and looping which the algorithm in the example relies on, so that kind of puts me back in the position where I have to be able to actually set the register. But just casting the uint64 down to an uint16 might take care of the wrapping for me.
Any advice you could give me would be welcome.