Hi,
In the first version of the code you called send
immediately after calling RadioControl.start. This
send occurs during the radio transceiver's startup
phase and will fail. By moving the send to the
RadioControl.startDone you can be sure the radio is
operational.
Communication cannot occur between two motes when
either one is in sleep mode. Numerous energy saving
communication protocols exist and usually involve
coordinating send and listen activities.
The default in TinyOS is called LPL, you should
probably look into using that...
Tony
--- margherita errichiello <[EMAIL PROTECTED]>
wrote:
> Dear all,
> I already wrote a previous e-mail, asking for your
> help with regard to
> the consumption of the CC2420 Radio of our "telosb
> mote". In that
> occasion you advised me to modify the starting
> programme.
> So, after following your advice I solved the problem
> of excessive
> consumption that I had met, but I was not able to
> understand why the
> previous version of the programme took so much time
> and energy to
> switch on the Radio.
> Could you give me an explanation about the factors
> affecting the
> inefficient performance of the previous programme?
> Why is the last
> version of the programme working correctly?
> Besides, Id like to know about potential solutions
> to adopt so that
> the Radio can change its present state getting in a
> "Sleep" state.
> Does the radio require less energy to work in this
> new state? And does
> the "sleep" state allow the radio to receive any
> packets anyway?
> You can find the snippet codes below, both in the
> previous and the
> modified version (the one working).
>
>
> ****PREVIOUS VERSION****
> module MyComponent
> { uses
> { interface Boot;
> interface SplitControl as RadioControl;
> interface AMSend;
> interface Timer;
> }
> }
> implementation
> { typedef nx_struct oscilloscope
> { nx_uint16_t version;
> nx_uint16_t interval;
> nx_uint16_t id;
> nx_uint16_t count;
> nx_uint16_t readings[10];
> } oscilloscope_t;
> message_t sendbuf;
> oscilloscope_t local;
> event void Boot.booted ( )
> { call Timer.startPeriodic (10000);
> }
> event void RadioControl.startDone (error_t error) {
> }
> event void RadioControl.stopDone (error_t error) { }
> event void Timer.fired ( )
> { call RadioControl.start ( );
> call AMSend.send (AM_BROADCAST_ADDR, &sendbuf,
> sizeof local);
> }
> event void AMSend.sendDone (message_t* msg, error_t
> error)
> { call RadioControl.stop ( );
> }
> }
>
> ******** MODIFIED VERSION ***************
>
> module MyComponent
> { uses
> { interface Boot;
> interface SplitControl as RadioControl;
> interface AMSend;
> interface Timer;
> }
> }
> implementation
> { typedef nx_struct oscilloscope
> { nx_uint16_t version;
> nx_uint16_t interval;
> nx_uint16_t id;
> nx_uint16_t count;
> nx_uint16_t readings[10];
> } oscilloscope_t;
> message_t sendbuf;
> oscilloscope_t local;
> event void Boot.booted ( )
> { call Timer.startPeriodic (10000);
> }
> event void RadioControl.startDone (error_t error) {
> call AMSend.send (AM_BROADCAST_ADDR, &sendbuf,sizeof
> local);
> }
> event void RadioControl.stopDone (error_t error) { }
> event void Timer.fired ( ){
> call RadioControl.start ( );
> }
> event void AMSend.sendDone (message_t* msg, error_t
> error){
> call RadioControl.stop ( );
> }
> }
>
**************************************************************************
> Thanks in advance.
> I look forward to hear from you.
>
> Margherita
> _______________________________________________
> 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