U need a debug mode, e.g.,
dbg(DBG_TEMP, "Counter: Value is %i\n", (int)state); here the mode is 'temp'. To get the message in the console, u need to export the debug mode with the following command before u run the program. export DBG=temp On 4/6/07, Mehedi Bakht <[EMAIL PROTECTED]> wrote:
Hi, I am using T-2 and TOSSIM on cygwin. I have written a very simple sender-receiver program to test radio communication. I have put dbg statements at different places including sendDone and Receive. When I run the program with TOSSIM, the dbg statements in the sendDone and receive function never gets printed (which probably implies that the two functions never gets called). But dbg statements from other functions (like when the timer fires) works fine. I have tried increasing the length of simulation but still no improvement. On the other hand, when I install that same program on tmotes - it works fine. I have verified successful send and receive operations by switching on/off the leds. Can anyone help me find out why it is behaving strangely in TOSSIM? The actual code has been pasted below in case anyone wants to have a look. Thanks, --Mehedi #include <Timer.h> #include "TestSender.h" configuration TestSenderAppC { } implementation { components MainC; components TestSenderC as MyModule; components ActiveMessageC; components new AMSenderC(20); components new AMReceiverC(20); components new TimerMilliC() as MyTimer; components LedsC; /* My module has an interface boot and it is basically wired to the boot interface of MainC. */ MyModule.Boot -> MainC.Boot; MyModule.AMSend -> AMSenderC; MyModule.Receive -> AMReceiverC; MyModule.AMControl -> ActiveMessageC; MyModule.Packet -> AMSenderC; MyModule.Timer0 -> MyTimer; MyModule.Leds -> LedsC; } ********************************************************** module TestSenderC { uses { interface Boot; interface AMSend; interface Packet; interface Receive; interface Leds; interface SplitControl as AMControl; interface Timer<TMilli> as Timer0; } } implementation { bool sendChannelBusy = FALSE; message_t packet; event void Boot.booted() { dbg("Log","[%s] Booted successfully at %s\n",__FUNCTION__,sim_time_string()); //Let us start the radio call AMControl.start(); } event void AMControl.startDone(error_t err) { if (err == SUCCESS) { dbg("Log","[%s] Radio has been successfully started at %s\n",__FUNCTION__,sim_time_string()); if(TOS_NODE_ID == 1) { //Let us start timer call Timer0.startPeriodic(5000); } else { call Leds.led0Toggle(); } } else { call AMControl.start(); } } event void AMControl.stopDone(error_t err) { if (err == SUCCESS) { dbg("Log","[%s] Radio has been successfully stopped at %s\n",__FUNCTION__,sim_time_string()); } } event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) { dbg("Log","[%s] Packet has been successfully received%s\n",__FUNCTION__,sim_time_string()); call Leds.led0Toggle(); return msg; } event void Timer0.fired() { dbg("Log","[%s] Timer has fired at %s\n",__FUNCTION__,sim_time_string()); if(!sendChannelBusy) { TestSenderMsg *msgptr; int i; msgptr = (TestSenderMsg*)(call Packet.getPayload (&packet,NULL)); for(i = 0; i < 10; i++) msgptr->data[i] = i*20; if (call AMSend.send(AM_BROADCAST_ADDR, &packet,sizeof(TestSenderMsg) ) == SUCCESS) { dbg("Log","[%s] Trying to send a packet %s\n",__FUNCTION__,sim_time_string()); sendChannelBusy = TRUE; call Leds.led0On(); } } } event void AMSend.sendDone(message_t* msg, error_t error) { if(msg == &packet) { dbg("Log","[%s] Packet sent successfully %s\n",__FUNCTION__,sim_time_string()); sendChannelBusy = FALSE; call Leds.led0Off(); } } } _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help