[Tinyos-help] Apparent Timing Bug in RssiSample

Tal Rusak tr76 at cornell.edu
Mon Jan 14 15:21:18 PST 2008


Hi,
     In testing RssiSample some more, I tried to reduce the collection
period from 1 ms to 0.5 ms. (I tried this on all three variations
below). However, the application did not work and never collected
data to the serial port at the higher frequency.
     Is there some fundamental limit to how fast RssiSample can collect?
If not, then I will look into this issue more deeply.

Thanks,
Tal

> Hi,
>      I have noticed an apparent bug the tinyos-2.x-contrib application
> RssiSample. In
> /tinyos-2.x-contrib/stanford-sing/apps/RssiSample/NoiseSampleP.nc, on
lines 197-201, the Alarm0.fired() even is implemented as follows:
>   197 	async event void Alarm0.fired()
>   198 	{
>   199 		call Resource.request();
>   200 		call Alarm0.start(ALARM_PERIOD);
>   201 	}
>      I believe that calling Resource.request() before
> Alarm0.start(ALARM_PERIOD) causes a time lag since the next alarm does
not start until after the call to Resource.request() returns.
>      There are two possible patches that I have come up with.
>
> 1)   Switch the order of the calls, i.e.,
>
>   197 	async event void Alarm0.fired()
>   198 	{
>   199 		call Alarm0.start(ALARM_PERIOD);
>   200 		call Resource.request();
>   201 	}
>
>      It may be the case that this introduces a race condition.
>
> 2)   Use a periodic timer (see attached code).
>
>      I have audited collection time for 61440 samples (1 minute clock
> time) for each of the approaches with the following results (four runs
of each):
>
> Original
> 000:01:08.593
> 000:01:08.730
> 000:01:08.781
> 000:01:08.699
>
> Swapped calls (correction 1)
> 000:01:03.311
> 000:01:03.229
> 000:01:03.193
> 000:01:03.339
>
> Periodic Timer (correction 2)
> 000:01:00.238
> 000:01:00.250
> 000:01:00.324
> 000:01:00.255
>
>       These results were collected using the stopwatch program
> (http://expect.nist.gov/stopwatch/) by looking at the LEDs on a telosb
mote.
>
> Thanks,
> Tal_______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help






More information about the Tinyos-help mailing list