[En-Nut-Discussion] Request for Comment: NutTimerMillisToTicks()

Matthias Ringwald mringwal at inf.ethz.ch
Wed Oct 25 16:44:20 CEST 2006


Hi Harald & others.

I just stumpled upon this mail while wondering about the avr timer  
being 3% off
(caused by incorrect NUT_TICK_FREQ calculaction).

Sure, we should use the correct tick calculation.
And yes, having a tick >= 1 looks reasonable.

As nobody complaint since may, I guess we should just copy  
NutTimerMillisToTicks()
from lpc2xxx to the other platforms.

I would volunteer to do it for the AVR, as I can actually test it,
or would you like to change all for once?

Cheers
  Matthias



On 15.05.2006, at 18:35, Harald Kipp wrote:

> Hi all,
>
> Shane Buckham and Michael Fischer recently reported, that
> the calculation in NutTimerMillisToTicks() is wrong.
>
>    return ms * 1000L / NutGetTickClock();
>
> should have been
>
>    return ms * NutGetTickClock() / 1000L;
>
> Michael already corrected this for the LPC2xxx, but for
> all remaining platforms it is still wrong. It had been
> undetected, because typically NutGetTickClock() returns
> 1000.
>
> Here's the request: Michael modified NutTimerMillisToTicks()
> in that way, that it returns at least 1, never 0. As far as
> I can see, it would not make any difference if the one-shot
> timer is started with 0 or 1 ticks left. In my view Michael's
> solution looks cleaner.
>
> Harald
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion




More information about the En-Nut-Discussion mailing list