Hi Nicolas,
On Thursday 31 May 2007 01:48, Nicolas Esteves wrote:
> I'm working with telosb and I'm trying to find a solution to estimate
> the time taken by some operation accurately (micro second). I first
> tried the TimerMicro but as i found after in the mailing list (here
> http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2007-May/024953.h
>tml) I understood that it was not a good solution and followed the Cory's
> advice: trying with a Counter<TMicro,uint32_t> and then Counter<TMicro,
> uint16_t>. I made a very simple test program: an infinite loop in the
> Boot.booted event which calculate dt between 2 loops and generate a 0 or 1
> on one of the pins of the mote if dt >= INTERVAL. Then i looked at the
> signal on an oscilloscope and measured the period of the "wave". I found
> that i can't have it < 16 us, ie with values of INTERVAL between 1 and
> 16-18 the period is the same. I wondered if it was normal since my program
> is only doing this.
If you take a look at the msp430 user's guide (I'm looking at version 'f'),
section 3.4.4 shows processor cycles per instruction, which appear to vary
between 1 and 5. If the average were, say 3.5 cycles per instruction, and
the tmote is running at 4Mhz, then about 19 instructions can execute in 16us
if my math is right. That doesn't seem unreasonable.
> I have also another question, I got jitter in my signal
> and i would like to understand why, i thought that
> gpio.set, gpio.clr and counter.get were done in constant time.
Perhaps interrupts are occurring? From the math above, you can see that it
wouldn't take much code in an ISR to give you visible jitter. The ugly way
to check this out would be to wrap the loop in an atomic section and see what
happens...
All the best,
Steve
>
> here is my loop:
>
> event void Boot.booted()
> {
> uint16_t t;
> uint16_t t0 = call Counter0.get();
>
> call outIO.makeOutput();
>
> while(TRUE)
> {
> t = call Counter0.get();
> if(t-t0 >= INTERVAL)
> {
> if( up )
> call outIO.set();
> else
> call outIO.clr();
>
> up = !up;
>
> t0 = t ;
> }
> }
> }
>
> Maybe I made something wrong. Can anyone help me with it?
> Thanks
>
> Nicolas
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
> !DSPAM:465ec828292471804284693!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help