[Tinyos-help] where to set the power level?
Urs Hunkeler
uhu at gmx.ch
Tue Dec 16 22:46:54 PST 2008
Hi,
A typical Makefile in TinyOS 2.x that I use looks something like this:
--------------------
COMPONENT = MyDemoAppC
CFLAGS += "-DCC2420_DEF_RFPOWER=1"
#CFLAGS += "-DCC2420_DEF_CHANNEL=18"
#CFLAGS += "-DTOSH_DATA_LENGTH=64"
include $(MAKERULES)
--------------------
There is no need for any modifications in the code (if I remember
correctly, the TX power level was set in multiple places). Defining the
power level in the CFLAGS (as in the example above) will have precedence
over the values that would otherwise be set in the TinyOS code.
You can also set the TX power level on a per-packet basis with code
similar to this (right before sending the packet):
--------------------
call CC2420Packet.setPower(&packet, pwr);
--------------------
&packet is a reference to the radio packet you want to transmit
(message_t), pwr is the power level you want the packet to be sent with
(e.g. 3) and CC2420Packet is an interface available from the component
CC2420PacketC.
I don't know whether there is a difference in the output power between 1
and 3, but a value of 1 definitely works to reduce the power in my setup
(with telosb with the internal antenna I get a max tx distance of about 3m).
If this still does not work for you, do you have modified hardware (e.g.
external antenna)? Do you at least observe a difference in the TX range
(e.g. 20m instead of 50m)?
Cheers,
Urs
BAI LI wrote:
> I just tested it. Same here. Not working. Thanks for your help anyway. Any
> other ideas?
>
> Cheers,
> Bai
>
> On Wed, Dec 17, 2008 at 12:59 PM, Hui Kang <hukang at ic.sunysb.edu> wrote:
>
>> Add this line to your makefile and remove those macro.
>> CFLAGS=-DCC2420_DEF_RFPOWER=3
>>
>>
>> - Hui
>>
>> BAI LI wrote:
>>
>>> I read the cc2420 datasheet and modified it but unluckily it still didn't
>>> work. I modified the following code repectivcely.
>>> #ifndef CC2420_DEF_RFPOWER
>>> #define CC2420_DEF_RFPOWER 0x1F // changed the 0x1F to 3 or 1,
>>> didn't work.
>>> #endif
>>> cheers,
>>> Bai
More information about the Tinyos-help
mailing list