Hi David,
I just did a small test and for me it worked, maybe you are
accidentally setting the macRxOnWhenIdle attribute to TRUE? You find
my test code below, e.g. copy into
apps/tests/tkn154/nonbeacon-enabled/TestActiveScan/coordinator/TestActiveScanCoordC
(and to verify set an LED in void offSpiReserved() and reset the same
LED in ReliableWait.waitRxDone(), in
tos/chips/cc2420_tkn154/CC2420TKN154P.nc).
Jan
event void Boot.booted() {
call MLME_RESET.request(TRUE);
}
event void MLME_RESET.confirm(ieee154_status_t status) {
if (status != IEEE154_SUCCESS)
return;
call MLME_SET.macShortAddress(COORDINATOR_ADDRESS);
call MLME_SET.macAssociationPermit(FALSE);
//call MLME_SET.macRxOnWhenIdle(TRUE);
call MLME_START.request(
PAN_ID, // PANId
RADIO_CHANNEL, // LogicalChannel
0, // ChannelPage,
0, // StartTime,
15, // BeaconOrder
15, // SuperframeOrder
TRUE, // PANCoordinator
FALSE, // BatteryLifeExtension
FALSE, // CoordRealignment
NULL, // no realignment security
NULL // no beacon security
);
}
event void MLME_START.confirm(ieee154_status_t status)
{
call Led1Timer.startPeriodic(62500U); // fire timer every 1 sec
}
event void MLME_RX_ENABLE.confirm( ieee154_status_t status)
{
if (status == IEEE154_SUCCESS)
call Leds.led0Toggle();
}
event void Led1Timer.fired() {
call MLME_RX_ENABLE.request(FALSE, 0, 31250); // enable RX for 0.5 sec
}
On Wed, Nov 21, 2012 at 12:16 PM, David Rodenas <[email protected]> wrote:
> Hi Jan
>
> I asked about switching off periodically the radio transceiver in order to
> plan a duty cycle. Then, you told me I should use the MLME_RX_ENABLE
> interface provided by the Ieee802154NonBeaconEnabledC component. Well, I've
> done that, I mean, I've set a timer which represents a wakeup interval that
> when it expires, it should activate the radio transceiver during a time
> interval equal to RxOnDuration. My problem is that I'm not really sure if
> this really works. The reason is that a mote acting as a receiver node
> receives data when it should be sleeping! Here a brief explanation of my
> test with pseudocode:
>
> start() // the app starts
> {
> initialize Rx_enable component (call Init.init(););
> start periodic wakeup interval wiTimer;
> call MLM_RX_ENABLE(RxOnDuration);
> }
>
> MLME_RX_Enable.confirm() {} // It confirms that the radio is enabled
>
> wiTimer.fired () // the witimer expires
> {
> /*
> * Here I should call again MHME_RX_ENABLE with RxOnDuration.
> * call MLME_RX_ENABLE(RxOnDuration);
> * However, to this test, I do not make the call. As a result, the
> * radio should be disabled and the node cannot receive anything
> */
> return;
> }
>
> recv() // receive data (MCPS_DATA.indication())
> {
> // Here I have another node that periodically broadcasts a message.
> // When this message is received, it activates one of the receiver
> node'leds.
> }
>
> What am I considering that it's wrong? Does MHME_RX_ENABLE really work and
> after RxOnDuration, the radio goes to sleep mode?
>
> Thanks,
>
> David
>
>
>
>> Date: Wed, 14 Nov 2012 12:45:25 +0100
>> Subject: Re: [Tinyos-help] Sleeping in TKN154
>> From: [email protected]
>> To: [email protected]
>> CC: [email protected]
>>
>> Hi David,
>>
>> there are two places where you can implement such duty-cycling: (a) on
>> top of the MAC: your component would wire to MLME_RX_ENABLE interface
>> provided by Ieee802154NonBeaconEnabledC and you would have a periodic
>> timer that fires at the desired ON-Time. In the event-handler you
>> would call MLME_RX_ENABLE with a "RxOnDuration" parameter matching
>> your ON-time interval. If timers are not accurate enough for you
>> (because they fire in task context), you (b) could use Alarms instead.
>> Then you would have to modify the MAC. You could extend RxEnableP with
>> your own async duty-cycle configuration interface and also modify its
>> interface towards DispatchUnslottedCsmaP (which you would also have to
>> extend / make async). Unless you need such accurate timing, you'd
>> probably go for option (a) -> you can make some tests to find out
>> when the radio actually changed state (to see if it satisfies your
>> timing requirements): just set the "tkn154debug" flag and you will get
>> statistics via printf (see apps/tests/tkn154/README.txt for details).
>>
>> Jan
>>
>> On Wed, Nov 14, 2012 at 11:32 AM, David Rodenas <[email protected]>
>> wrote:
>> > Hi all
>> >
>> > I am interseted in programming a duty-cycling scheme by making use of
>> > the
>> > TKN154 libraries. In particular, I want to induce the motes to periods
>> > of
>> > activity (ON) and inactivity (OFF) over the IEEE 802.15.4 non-beacon
>> > mode.
>> > As example:
>> >
>> >
>> > ||+------------+---------------------+------------+---------------------+------------+-------------------
>> > ||+ ON | OFF | ON | OFF
>> > | ON | OFF ...
>> >
>> > ||+------------+---------------------+------------+---------------------+------------+-------------------
>> > ||+ IEEE 802.15.4 NON-BEACON MODE
>> > ...
>> >
>> > ||+---------------------------------------------------------------------------------------------------------
>> >
>> > My problem is not how to sinchronize nodes for transmission and
>> > reception;
>> > it's knowing which components or libraries can I use to control de
>> > CC2420,
>> > and switch the radio ON/OFF periodocally. I've been trying to figure out
>> > how
>> > to do it through the LowPowerListening component (but I cannot use it
>> > because my protocol does not requires the transmission of preambles), or
>> > taking shots in the dark with the TKN files at /tos/lib/mac/tkn154, but
>> > I am
>> > completely lost.
>> >
>> > Please, any help possible would be appreciated.
>> >
>> > Thanks
>> >
>> > David
>> >
>> > _______________________________________________
>> > 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
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help