This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Suggestions for low power time keeping on nRF51?

I'm trying to decide the best way to be able to have sub millisecond time keeping, but keep the processor sleeping until it gets a hardware interrupt.

Basically I need to time the period of pulse signals, e.g from a flow meter. Where I may get one pulse every 20 or 30 secs, or possibly several pulses on one second.

Timing to the nearest millisecond would be adequate, but sub millisecond e.g. 100nS would be preferable for accuracy.

The hardware has the external 32kHz crystal, so I was hoping simply to somehow use the hardware counter of the RTC, I'm not sure if that is possible.

On other MCU's I've been able to configure the divider on the 32kHz clock into a hardware counter register, and then simply read the value of the register, to get a fairly accurate time.

(I realise that the counters can roll over, so I need to trigger an interrupt on rollover to handle this)

Is there a way to do something like this on either the nRF51 or even the nRF52?

BTW. I have seen some solutions where the RTC triggers an interrupt which wakes the processor and increments a counter, but I think this would not work for me because I'd need at least 1000 interrupts per second, and the processor would spend most of its time wake in the ISR

Related