[En-Nut-Discussion] Low level timer functions

Harald Kipp harald.kipp at egnite.de
Fri Jun 10 16:09:54 CEST 2005


Vesa,

as long as the main crystal is used, 1 ms is the standard setting.
With the 32 kHz clock crystal, there are not so many option.
0.9765625 ms (32 cycles) seems to be a good choice. I'm not
sure at the moment, how to make it generally configurable.

For timeouts (NutEventWait), the deviation is not critical.
The calculation of the number of seconds since system start
should be as accurate as possible, though. The above value is
exactly 1/1024 seconds, which is fine for date/time calculations.

High timer resolution is nice for some applications, but bad
for general system performance. Furthermore, the ATmega is
able to wake up from a special low power sleep mode (main
crystal osc. switched off). Waking up the chip too often
will consume more energy. Initially Nut/OS had been running
on a 3.6864 MHz ATmega103 and 62.5 ms was OK for the timer.
IMHO, we can change the default to about 1 ms now.

If higher resolution are required, the application should
not use the system timer.

I want to remove all these counters from the interrupt routine.
Just one plain tick counter should be kept. All other routines
could do there own calculations based on this counter. The
goal is to reduce the interrupt processing to a bare minimum.

Harald

At 16:33 10.06.2005 +0300, you wrote:

>I don't exactly know where in the code depends on 62.5ms, but I would also 
>like to this be configurable. I have one project where it would be a good 
>idea to have /2 for it, but I didn't try to modify it back then as I 
>wasn't sure what would be broken by changing it.
>
>Does anyone know are there any code pieces in Nut/OS depending on this one?...




More information about the En-Nut-Discussion mailing list