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

Matthias Ringwald mringwal at inf.ethz.ch
Wed Dec 20 16:19:42 CET 2006


I've copied NutTimerMillisToTicks() from arch/arm/ostimer_lpc2xxx.c
to arch/avr/ostimer.c as volunteered 2 months ago. :)

cheers,
  m.

Begin forwarded message:

> From: "Matthias Ringwald" <mringwal at inf.ethz.ch>
> Date: 25. Oktober 2006 16:44:20 GMT+02:00
> To: "Ethernut User Chat \(English\)" <en-nut-discussion at egnite.de>
> Subject: Re: [En-Nut-Discussion] 	
> Reply-To: "Ethernut User Chat \(English\)" <en-nut- 
> discussion at egnite.de>
>
> 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
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
Begin forwarded message:

> From: "Brett Abbott" <Brett.Abbott at digital-telemetry.com>
> Date: 25. Oktober 2006 22:37:16 GMT+02:00
> To: "Ethernut User Chat \(English\)" <en-nut-discussion at egnite.de>
> Subject: Re: [En-Nut-Discussion] Request for Comment:  
> NutTimerMillisToTicks()
> Reply-To: "Ethernut User Chat \(English\)" <en-nut- 
> discussion at egnite.de>
>
> Hi Matthias
> Sounds like the best approach.  Worth testing just in case prior to  
> release.
> Brett
>
>
> _______________________________________________
> 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