Hello Linas, I have checked your code and it seems it is a possible bug left in system. When I comment line 64 in TestPrintfC.nc file timer starts to work properly.
Perhaps someone from TOS developers can confirm it ? -- Best regards Mindaugas Jaraminas 2009/4/28 Linas Ramanauskas <[email protected]>: > Hello, > > Here is a demo application where each two seconds timer should fire > and print time returned by getNow(). To start the timer, > startPeriodicAt(delay, interval) is called at > RadioControl.startDone(). If delay is 100ms timer works correctly and > fires each 2 seconds. If delay is 200ms timer starts to fire without > any responsibility and fires in a rate of couple ms. > > > Correct result (displayed time is in ms): > > Boot.booted() delay = 100, interval = 2048 > RadioControl.startDone() SUCCESS > 2148 > 4196 > 6244 > 8292 > ... > > Incorrect result (displayed time is in ms): > > Boot.booted() delay = 200, interval = 2048 > RadioControl.startDone() SUCCESS > 143 > 149 > 150 > 152 > 158 > 160 > ... > > > If call RoutingControl.start(); is commented in both cases timer works > correctly. Please, can anyone tell me what is wrong? Is it a bug? > Source code is below and also attached to this e-mail. Tested with > TinyOS 2.1.0 released at 2009/02/05 with a TelosB platform. > > > *** File: Makefile *** > > COMPONENT=TestPrintfAppC > CFLAGS += -I$(TOSDIR)/lib/printf > > CFLAGS += -I$(TOSDIR)/lib/net \ > -I$(TOSDIR)/lib/net/le \ > -I$(TOSDIR)/lib/net/ctp > > include $(MAKERULES) > > > > *** File: TestPrintfAppC.nc *** > > #include "printf.h" > > configuration TestPrintfAppC{ > } > implementation { > components MainC, TestPrintfC; > components new TimerMilliC() as TestTimer; > > TestPrintfC.Boot -> MainC; > TestPrintfC.TestTimer -> TestTimer; > > components ActiveMessageC; > TestPrintfC.RadioControl -> ActiveMessageC; > > components CollectionC as Collector; > TestPrintfC.RoutingControl -> Collector; > > components new CollectionSenderC(1) as CollectionSender; > TestPrintfC.CollectionSend -> CollectionSender; > } > > > > *** File: TestPrintfC.nc *** > > #include "printf.h" > > module TestPrintfC (){ > uses { > interface Boot; > interface Timer<TMilli> as TestTimer; > > interface SplitControl as RadioControl; > interface StdControl as RoutingControl; > interface Send as CollectionSend; > } > } > implementation { > uint32_t delay; > uint32_t interval; > > event void Boot.booted() { > delay = 200; > interval = 2048; > call RadioControl.start(); > printf("\nBoot.booted() delay = %lu, interval = %lu\n", delay, interval); > printfflush(); > } > > event void RadioControl.startDone(error_t err) { > printf("RadioControl.startDone() "); > > if (err == SUCCESS) { > call RoutingControl.start(); // if this is commented timers > works correctly > printf("SUCCESS\n"); > } > else { > call RadioControl.start(); > printf("FAIL\n"); > } > > printfflush(); > call TestTimer.startPeriodicAt(delay, interval); > } > > event void TestTimer.fired() { > printf("%lu\n", call TestTimer.getNow()); > printfflush(); > } > > event void RadioControl.stopDone(error_t err) {} > > event void CollectionSend.sendDone(message_t *m, error_t err) { > printf("CollectionSend.sendDone()\n"); > printfflush(); > } > } > > > Best regards, > Linas Ramanauskas > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
