[Tinyos-help] Timer going crazy
David Gay
dgay42 at gmail.com
Fri Jun 1 09:27:36 PDT 2007
Sounds like the mica timer bug in 2.0.0. Have you tried 2.0.1?
David Gay
On 6/1/07, Pedro Almeida <pedralm at gmail.com> wrote:
> Hello;
>
> So I've been working over the TestNetwork application, and now have two
> timers implemented, both doing exactly the same, except for the periods of
> the timers and some fields in the message. Both go like:
>
> task void sendKeepAlive() {
> TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet);
> uint16_t metric;
> am_addr_t parent;
>
> call CtpInfo.getParent(&parent);
> call CtpInfo.getEtx(&metric);
>
> msg->source = TOS_NODE_ID;
> msg->seqno = seqno;
> msg->datah = 0x20;
> msg->datal = 0x00;
> msg->parent = parent;
> msg->hopcount = 0;
> msg->metric = metric;
>
> if (call Send.send(&packet, sizeof(TestNetworkMsg)) != SUCCESS) {
> failedSend();
> dbg("TestNetworkC", "%s: Transmission failed.\n", __FUNCTION__);
> }
> else {
> sendBusy = TRUE;
> seqno++;
> call Leds.led2Toggle();
> dbg("TestNetworkC", "%s: Transmission succeeded.\n", __FUNCTION__);
> }
> }
>
> the task above is ran when the timer triggers here:
>
> event void Timer1.fired(){
> if (!sendBusy) {
> post sendKeepAlive();
> }
> }
>
> and the timer is created with
>
> call Timer1.startPeriodic(TIMER_PERIOD_KEEP_ALIVE);
>
> where the period is around 5 seconds.
>
> the sendDone is as follows:
>
> event void Send.sendDone(message_t* msg, error_t err) {
> if (err != SUCCESS) {
> }
> sendBusy = FALSE;
> dbg("TestNetworkC", "Send completed.\n");
> }
>
> and the failedSend is:
>
> void failedSend() {
> dbg("App", "%s: Send failed.\n", __FUNCTION__);
> call CollectionDebug.logEvent(NET_C_DBG_1);
> }
>
>
> both tasks use the same sendDone/failedSend (since both taks have just about
> the same code).
>
> what happens is that a few timer cycles after the program has started (where
> everything works fine), the yellow led (led2) starts blinking continuously
> as if the timer was only of a few miliseconds, which indicates the
> associated task with the timer is being called repeatedly, without apparent
> respect for the timer.
> the only solution is to shut down and on the mica z mote (after a while,
> the problem again arises). This happens even when the other timer is
> disabled!
>
> What may be causing this?
>
> Thanks in advance,
>
> Pedro
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
More information about the Tinyos-help
mailing list