[Tinyos-help] Time counting
Cory Sharp
cory at moteiv.com
Wed Jan 3 18:16:26 PST 2007
It is documented
1) In the TinyOS 1.x Timer interface nesdoc
2) In the TinyOS 2.x Timer interface nesdoc
3) In TEP 102 Timers
4) In this tinyos-help mailing list
One major omission seems to be in the tutorials.
Cory
On 1/3/07, Michael Newman <mnewman at dragonnorth.com> wrote:
>
> This seems to work much better. Where will I find it documented?
>
> ------------------------------
> *From:* cory.sharp at gmail.com [mailto:cory.sharp at gmail.com] *On Behalf Of *Cory
> Sharp
> *Sent:* Wednesday, January 03, 2007 7:53 PM
> *To:* Michael Newman
> *Cc:* tinyos-help at millennium.berkeley.edu
> *Subject:* Re: [Tinyos-help] Time counting
>
> Treat the clock in binary millieseconds (1024 Hz) instead of decimal
> milliseconds (1000 Hz). With the clock is running at 1024 ticks per second,
> then you lose about 1.5 seconds per minute if you wait 1000 ticks instead
> of 1024. - Cory
>
> On 1/3/07, Michael Newman <mnewman at dragonnorth.com> wrote:
> >
> > For time counts driven by a crystal the types of errors you are talking
> > about should result in time variations of seconds per day. What I am seeing
> > is seconds per *minute*.
> >
> > A repeating counter set to 1000 milliseconds should count seconds with
> > some jitter. I don't expect the events to be exactly on the second, I do
> > expect the number of events per hour to be correct. Basically the timers are
> > driven off of the watch crystal which counts the ATmega128 counters. I
> > expect to *schedule *an event every time the ATmega128 counter passes
> > the appropriate number of ticks. I do not expect the events to get lost, nor
> > do I expect extra events. I expect the events to be near in time to the tick
> > that triggered them but not exact in time, because there may be other tasks
> > that compete for the exact time.
> >
> > In any case counting fast indicates a flaw, competing for resources and
> > failing to get them would result in slow counts.
> >
> > ------------------------------
> > *From:* cory.sharp at gmail.com [mailto:cory.sharp at gmail.com] *On Behalf Of
> > *Cory Sharp
> > *Sent:* Wednesday, January 03, 2007 6:01 PM
> > *To:* Michael Newman
> > *Cc:* tinyos-help at millennium.berkeley.edu
> > *Subject:* Re: [Tinyos-help] Time counting
> >
> > Of course the device capable for some definition of capable. But the
> > keyword isn't capability but calibration: ensuring the mote records accurate
> > time across varying conditions and manufacture. Keep in mind that "varying
> > conditions" even includes things like turning on a high power sensor causing
> > a drop in system voltage. A "causal relation" to wall clock time stands to
> > reason, though perhaps you meant "casual relation". Beyond that, I'm not
> > sure of what precisely both your observations and expectations are.
> >
> > Cory
> >
> > On 1/3/07, Michael Newman <mnewman at dragonnorth.com> wrote:
> > >
> > > I actually discovered this problem when I started to implement a time
> > > synchronization protocol. I am trying to log the time a sample was actually
> > > taken on the mote and when that mote comes back in radio range report the
> > > list of samples and times they were taken.
> > >
> > > The problem is that my logs of when the samples were taken bear only
> > > causal relation to wall clock time.
> > >
> > > The hardware is capable of much more than this. I think there is a
> > > watch crystal on the Mica2 and Mica2Dot motes and time could be accurately
> > > counted and reported.
> > >
> > > ------------------------------
> > > *From:* cory.sharp at gmail.com [mailto:cory.sharp at gmail.com] *On Behalf
> > > Of *Cory Sharp
> > > *Sent:* Wednesday, January 03, 2007 5:27 PM
> > > *To:* Michael Newman
> > > *Cc:* tinyos-help at millennium.berkeley.edu
> > > *Subject:* Re: [Tinyos-help] Time counting
> > >
> > > The timer system in TinyOS does not guarantee any particular
> > > accuracy, only that "accuracy MUST remain reasonable", probably something
> > > like +/-10% of the declared units. This is for various reasons including
> > > but not limited to temperature, voltage, and manufacturing variations that
> > > affect hardware clocks, particular features or lack thereof offered by a
> > > microcontroller or its hardware platform, and timer computation choices
> > > within TinyOS.
> > >
> > > Probably the time units are actually 1024 ticks per second not 1000.
> > > Even so, as listed above, there are many reasons why it may not be for your
> > > particular platform in general or given its current environmental and
> > > electrical conditions.
> > >
> > > If you need more accuracy, it is best that you incorporate a time
> > > synchronization protocol into your application.
> > >
> > > Best,
> > > Cory
> > >
> > > On 1/3/07, Michael Newman <mnewman at dragonnorth.com> wrote:
> > > >
> > > > I have a complex application with a half dozen timers. One of the
> > > > timers is used to count a clock once per second. The timer is set up with a
> > > > call that looks like this:
> > > >
> > > > call TimerClock.start(TIMER_REPEAT,1000);
> > > >
> > > > The timer is never stopped or changed.
> > > >
> > > > I count a variable in the TimerClock.fired event. I expect this
> > > > variable to reflect the number of seconds since the node has booted. What I
> > > > observe is that the counter counts faster than the actual number of elapsed
> > > > seconds.
> > > >
> > > > Given other activities and the possibility of interrupts being off
> > > > for some periods I do not expect the timer to fire at an exact interval,
> > > > what I do expect is that the frequency of the timer will be exact with some
> > > > jitter to the individual firing events. I also expect the timer to never
> > > > fire early.
> > > >
> > > > Has anyone verified that timers actually fire on an exact interval
> > > > and that time is neither lost nor gained?
> > > >
> > > >
> > > >
> > > > ------------------------------
> > > >
> > > > Michael Newman
> > > >
> > > > Dragonnorth Group
> > > >
> > > > 319 Dean Rd.
> > > > Brookline, MA 02445
> > > >
> > > > Cell: 617 821-4608
> > > > Home: 617 566-7975
> > > > Fax: 617 566-7975
> > > >
> > > > www.dragonnorth.com
> > > >
> > > > mnewman at dragonnorth.com
> > > >
> > > >
> > > > _______________________________________________
> > > > Tinyos-help mailing list
> > > > Tinyos-help at Millennium.Berkeley.EDU
> > > > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> > > >
> > > >
> > > >
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20070103/b93dc1f6/attachment.html
More information about the Tinyos-help
mailing list