[En-Nut-Discussion] Timers running slow

Harald Kipp harald.kipp at egnite.de
Fri Apr 28 10:26:02 CEST 2006


Greg,

At 21:56 27.04.2006 -0600, you wrote:

>I'm having some trouble getting a simple timer to run on in my
>application (a modified version of httpserv).  The timer does run, but
>much slower than it should (approx 2-3 times too slow).  My timer
>callback function is this:
>
>void TimerCallback(HANDLE timer, void *arg)
>{
>     PORTB^=0x08;
>}

Timer callbacks are deprecated. There had been several discussions,
wether we should completely remove them. They are running in
interrupt context and may spoil the real time behavior. Instead
of removing them, we decided to execute timer callbacks during
context switches. This provides some backward compatibility, but
the exact timing is lost.

You should use timer interrupts in your application instead.
Timer 0 is reserved for Nut/OS, all other timers may be freely
used by your application.

Sorry for any outdated documentation, which may have mislead you.

Harald




More information about the En-Nut-Discussion mailing list