Hi Ramakrishna,

Before sending a packet, do:

...
call CC2420Config.setChannel(<channel>); // 11 or 26, etc.
call CC2420Config.sync();
...

Then, send the packet inside the synchDone callback afterwards:

// Called after radio has tuned into a new channel
event void CC2420Config.syncDone(error_t error)
{
    if(error == SUCCESS) call AMSender.send(..);
    ...
}


Sergio Gonzalez


>  Hi , This is Ramakrishna, working on tinyos-2.1.1. I am experimenting on
>  dynamic channel switching for telosb mote. I am trying to send 2 packets
>  one in 26th channel and second in 11th channel. When i change the channel
>  from 26 to 11 after sending the first packet in my program, first packet
>  also being sent on 11th channel but not on 26th. why it is so? I am
>  modifying the channel only after getting 'sendDone' event of the first
>  packet. how it is overwriting the channel register with 11 before
>  transmitting the first packet? Please help me in this regard.
>
It is my understanding that sendDone gets generated when the last byte has
been transfered to the h/w.   It doesn't mean that the packet has acutally
transmitted.

So if you are changing the channel at that point you will probably cause
problems for the back part of the packet.

I'm not aware of an event being available from the h/w to indicate the
complete TX has finished.  Not sure if  current h/w  makes that
available....   You will need to stare at the radio docs.


You could try putting a delay of somekind to see if that helps.

As far as the channel register changing, I have no clue.



-- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to