Tickless Idle losing time

Using an nRF52840 with SDK 15.3 FreeRTOS 10.0 (Nordic code) project.  I've got a vApplicationTickHook() defined that checks up ticks and fires a seconds counter at tickHZ rate from the up ticks:

    if(++UpTicks >= configTICK_RATE_HZ){
        UpTicks = 0;

If I use tickless Idle, I see it loses about 3.4% of seconds over the course of 45 minutes.  If I don't use tockless Idle, I only see about 0.6% loss of seconds.

 I'm thinking that the thing is sometimes sitting more than a Tick in idle (which is reasonable I suppose in tickless idle).  What should I use to decide how many ticks I'm actually sitting idle with then?

  • Hi,

    Like , I suggest you use another timer. Specifically, a repeated app_timer, since this will (on average) be exactly as accurate as your 32.768 kHz clock source. Then the only additional thing you need to remember is that if you use the internal LFRC instead of the LFXO, then you need to regularly calibrate the oscillator (note that it is handled automatically if you use a SoftDevice).

Reply Children
No Data