[Tinyos-help] Cannot send message correctly

Philip Levis pal at cs.stanford.edu
Fri Dec 8 12:35:02 PST 2006


On Dec 8, 2006, at 8:43 AM, Lorenzo Mainardi wrote:

> Hi, I'm trying to send and receive message in Tinyos-2.x. I have  
> been foolowed the chapter 3 of Tutorial and I write this code:
>
> event void Timer.fired(){
> dbg("beacon", "Timer fired\n");
> if(busy)
>     dbg("beacon", "BUSY!!!");
> if(!busy){
>
>     beaconPayloadPtr = (BeaconMsg*) (call Packet.getPayload 
> (&beaconPacket, NULL));
>     beaconPayloadPtr -> msgCode=BEACON_CODE;
>     beaconPayloadPtr -> seed = call Random.rand16();
>     if (call BSend.send(AM_BROADCAST_ADDR, &beaconPacket, sizeof 
> (BeaconMsg)) == SUCCESS) {
>        // busy = TRUE;
>         dbg("beacon", "Message sent");
>     }
>
>     }}
>
>
>
> event void BSend.sendDone(message_t *msg, error_t error){
> dbg("beacon", "send done\n");
> if (&beaconPacket == msg) {
>     busy = FALSE;
>
>     }
>
>
> }
>
>
> If I try to debug my application, I send but I don't receive any  
> signal from the event sendDone.I think to have well linked all the  
> modules and interfaces
> Could you help me?
>

You are using TOSSIM? If you do not specify a radio topology then the  
default is for nodes to have a noise value of 0 dBm, which is well  
above their clear channel threshold. So the MAC layer backs off forever.

Phil


More information about the Tinyos-help mailing list