`

改变节点transmission power, radio power level (tx_power)

 
阅读更多
使用 CC2420Packet 中 setPower 来改变每个消息包的tx power
  /**
   * Set transmission power for a given packet. Valid ranges are
   * between 0 and 31.
   *
   * @param p_msg the message.
   * @param power transmission power.
   */
  async command void setPower( message_t* p_msg, uint8_t power );


There are 8 discrete power levels each corresponds to RF transmit power
>> > Power level   Transmitted power level
>> > 31                0dbm
>> > 27               -1dbm
>> > 23               -3dbm
>> > 19               -5dbm
>> > 15               -7dbm
>> > 11               -10dbm
>> > 7                -15dbm
>> > 3                -25dbm


原文
引用
    I'm looking to control the default radio power level at runtime for
    Telos motes using TinyOS-2.x.  In tos/chips/cc2420/CC2420Power.nc I
    see the following comment:


    "[This] does not include transmission power, see the CC2420Config interface."

    However, the CC2420Config interface does not include any command to
    set the default radio power level.  The file
    tos/chips/cc2420/CC2420ControlP.nc includes a state variable
    'm_tx_power' that is initialized to CC2420_DEF_RFPOWER; however, that
    variable is never used.  The file tos/chips/cc2420/CC2420TransmitP.nc
    directly uses CC2420_DEF_RFPOWER to set the default power level:

       if ( !tx_power ) {
         // If our packet's tx_power wasn't configured to anything but 0,
         // send it using the default RF power.  This assumes the
         // packet's metadata is all set to 0's on boot.

         tx_power = CC2420_DEF_RFPOWER;
       }

    It looks to me like the original intent was to provide a software
    interface for setting the default radio power level via the
    CC2420Config, but that its realization got lost along the way.  With
    the current implementation, I cannot see a way to set the default
    radio power in software.

    One way to resolve this would be to add two new commands to the
    CC2420Config interface:

       command uint8_t getDefaultTxPower();
       command void setDefaultTxPower(uint8_t txPower);

    Then, in CC2420ControlP add implementations of those commands (again,
    'm_tx_power' is already declared in this module and initialized to
    CC2420_DEF_RFPOWER):

       command uint8_t CC2420Config.getDefaultTxPower() {
           return m_tx_power;
       }

       command uint8_t CC2420Config.setDefaultTxPower(uint8_t txPower) {
           m_tx_power = txPower;
       }

    Then, in CC2420TransmitP use the CC2420Config interface, and call the
    getDefaultTxPower command to set the default power:

       if ( !tx_power ) {
         // If our packet's tx_power wasn't configured to anything but 0,
         // send it using the default RF power.  This assumes the
         // packet's metadata is all set to 0's on boot.

         tx_power = call CC2420Config.getDefaultTxPower();
       }

    Does this seem reasonable?  Am I missing some other mechanism to set
    the default radio power level in software?

    Thanks in advance for your assistance.

Looks like the comments are out of date with respect to the implementation.

Based on experiences in implementing protocols, the general approach TinyOS takes these days for things like TX power control, acknowledgements, etc., is to make them per-packet. Otherwise protocol A changes the radio settings, which causes protocol B to break. If you take a look at CC2420Packet, there's a command to set the TX power level of a given packet.

Phil



引用

Hi Prem,

As Christian pointed out, to reduce the transmission range you have to
reduce the transmission power. In Tinyos 2 with a platform with the
cc2420 (such as MicaZ and the Tmotes), you can use either a flag in the
makefile:

CFLAGS += "-DCC2420_DEF_RFPOWER=1"

or you can dynamically change the tx power at runtime (individually for
every packet) with something like (wire in the CC2420PacketC module):

call CC2420Packet.setPower(&rpacket, 1);

You'll have to issue that call for every packet prior to sending it.

Reducing the TX power to its minimum I get a maximum transmission range
of roughly 3 meters under ideal conditions.

Cheers,
Urs
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics