OK, that makes sense !
I had never thought about that, thank you.
I wonder if that explains such a difference though, I'll check.

Romain

On 5/24/07, David Moss <[EMAIL PROTECTED]> wrote:
Romain -

Are you specifying a second as "1000" or "1024"?

If you started a Timer with .startPeriodic(1000) or something, you would
definitely be seeing slightly shorter than a second.  Using binary
milliseconds, .startPeriodic(1024), is more accurate.

-David



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Romain
Thouvenin
Sent: Thursday, May 24, 2007 10:43 AM
To: David Gay
Cc: Jon Green; [email protected]
Subject: Re: [Tinyos-help] TimerMilliC.getNow() Giving strange values.

It reminds me of something I forgot to talk about.
I have a typical sensor network of telosb motes that send data to a
base station, which forwards the data to a Java application. The Java
application logs the data received.

Like oscilloscope, the motes sense 10 values, one per second, and send
the 10 values together. In the logs, the difference between two lines
are often 9 seconds (with a second precision), which I can understand,
but never 11.
Another application on the motes sends a message every 10 minutes,
which is also logged on the computer. The difference between two
messages is never 10 minutes or more, it is generally a few seconds
less, sometimes 15 or more.

I didn't investigate though as Jon did to get a proof, but tell me if
that would help.

Romain

On 5/24/07, David Gay <[EMAIL PROTECTED]> wrote:
> On 5/24/07, Jon Green <[EMAIL PROTECTED]> wrote:
> > I'm having a problem using the TimerMilliC component on a micaz mote.
> > Occasionally the local time as reported by the getNow() function seems
> > to jump backwards 255 microseconds, then jump forward and start counting
> > correctly.
>
> TinyOS 2.0 or 2.0.1? If 2.0, try 2.0.1 (the mica timer stuff was
rewritten).
>
> David Gay
>
> >  I am still researching the problem, but the sequence always seems to
> > look like this:
> > n-1
> > n-255
> > n+1
> > where n%255=0
> >
> > So maybe a 8 bit variable is overflowing somewhere in the counter code?
> > I was hoping someone a little more knowledgeable about tinyos might be
> > able to help me out and save me digging through all the timer subsystem
> > code.
> >
> > Heres a test case that shows this problem:
> >
> > module TestCaseC
> > {
> >   uses interface Boot;
> >   uses interface Timer<TMilli>  as Timer;
> >   uses interface UartDebug      as Uart;
> > }
> >
> > implementation
> > {
> >   uint8_t old;
> >   uint8_t current;
> >
> >   event void Boot.booted()
> >   {
> >     /* print anomalous values forever */
> >     for(;;)
> >     {
> >       old = current;
> >       current = call Timer.getNow();
> >
> >       /* if the counter screwed up */
> >       if(old > current)
> >       {
> >         /* output the values to the uart */
> >         call Uart.Print("\n");
> >         call Uart.PrintDec(total);
> >         call Uart.PrintDec(end);
> >         call Uart.PrintDec(call Timer.getNow());
> >       }
> >     }
> >   }
> >
> >   event void Timer.fired()
> >   {
> >   }
> >
> > }
> >
> > In the above test case UartDebug is just a component I use to output
> > debug data to the uart. PrintDec takes a 32bit number and outputs it to
> > the uart in decimal.
> >
> > Heres the first few lines of output from the test case:
> >
> > 255
> > 0
> > 258
> >
> > 511
> > 256
> > 515
> >
> > 767
> > 512
> > 771
> >
> > 1023
> > 768
> > 1027
> >
> > 1279
> > 1024
> > 1284
> >
> > 1535
> > 1280
> > 1540
> >
> > 1791
> > 1536
> > 1796
> >
> > 2047
> > 1792
> > 2052
> >
> > 2303
> > 2048
> > 2308
> >
> > 2559
> > 2304
> > 2564
> >
> > ...
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> >
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to