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

Reply via email to