[En-Nut-Discussion] timer problem

PragmaLab info at pragmalab.nl
Sun Dec 16 15:06:30 CET 2007

Hello Hansel,

> so i see that after the "crash" the timerlist is destroyed and an 
> endloss loop inside of  "NutTimerInsert" is working. Only one timer 
> exists, instead of my intended three timers, which really 
> exists before 
> (LED-Output).
> timer1->next = timer1; timer1->prev=timer1;
> timer2->next = timer3; timer2->prev= NULL;
> timer3->next = timer2; timer3->prev= NULL;
> had anyone a problem with timers in nut-os???

I'm not sure if the timer problem we worked around some half year ago is
related to yours. I just wanted to mention that we indeed had problems with
the timerroutines. What happened was:

1) we resuested a one-shot timer in thread A
2) used another timer in thread B (implicit by calling NutSleep(xxx))
3) manually killed the first one-shot timer while thread A was suspened
4) Noticed that when thread A woke up, it still assumed that the first
one-shot timer was there,
   killed it when it expired, but in fact was killing the wrong timer (of
thread B)
5) so the second timer of thread B never expired anymore, so thread B never
woke up, so the watchdog was not kicked, so.....

We even purchased an ICE50 to trace down this problem. The problem was 100%
reproducable and clearly we could see it happen in the tracebuffer (a
feature which is not available with a MKII -debugger). I've posted this
issue in this list but never got any reply.

First we used NutOS 3.9.6 which did not suffer from this problem because
timercallbacks run in interrupt context. We noticed the bug when we started
using 4.2.1 (to shorten interrupt latencies, callback functions no longer
run in interrupt-context).

Our workaround was (and still is) to use our own timeradministration.

Hope this helps?

Best regards,

Rob van Lieshout

More information about the En-Nut-Discussion mailing list