Details of how Timers work?

Is there some documentation somewhere that describes precisely how the timers work?

Not interested in how to use timers or code to use timers, but technically how they work underneath the covers.

I presume they trigger off a “tick” interrupt and there is a Timer scheduler that works out what Timers need to run?

If timer code is active and another timers “time period” triggers, what happens? Does the currently running timer handler get interrupted? Or are all timers blocked till a timer handler finishes? If it does get interrupted, by what mechanism does it resume interrupted timers? Or if it doesn’t, how does it schedule blocked timers? Can you overflow? or does it simply not invoke the timer handler?

Hi
Call-back function, provided in an adl_tmrSubscribe or adl_tmrSubscribeExt call, is notified
each time the related timer occurs.
The timer events would be delayed if the applicative task is pre-empted due to higher priority (applicative or firmware) tasks processing.

Regards
Paruthiv

I think the big question is: what happens if the handler takes so long that the same timer expires again before the handler has finished…

Start Periodic Timer
  |
  | timer 
  | running
  |
  +--expires--> Enter Handler
  |              |
  | timer        |handler
  | running      |running
  |              |for
  +--expires-->  |a          <<*** WHAT HAPPENS HERE??
  |              |long
  |              |time

See: BUG: In the ongoing saga of timers, our hero boldly codes

what happens if the Timers takes too long…

Is that your Timer will complete, then instantly the Timer handler gets triggered again.

This will eventually result in the the lowest priority task not being serviced. Which is the internal OS watchdog task…eventually it will starve and reset the device.

I have spent much time with problem timers lately, and found a bug in the OS where Timers would randomly stop. After giving Sierra a demo program that shows the failure, this has been an acknowledged bug in the OS by Sierra and will be fixed in a future version (7.45 is released, so will be after that)

Could you give more details of that?
And post (or PM) the demo?

I have some occasional field problems which do look like the timers stop working - but have never been able to reproduce it on the bench…