This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to set the CC2530 output power to 4.5dBm

Other Parts Discussed in Thread: CC2530, Z-STACK, TIMAC

How to set the CC2530 output power to 4.5dBm:

I am now using CC2530ZDK @ Z-Stack 2.3.0-1.4.0 @ Sensor Demo software, I regard the output power maybe not set at 4.5 dBm, than the range can't achieve to 400m, and just at 200m,

the follow is copy from z_mac internal.h

--------------------------------------------------------

// MAC Type Indication
#define ZMAC_F8W

// PHY transiver output power values
#define OUTPUT_POWER_0DBM       0x00
#define OUTPUT_POWER_N1DBM      0x21
#define OUTPUT_POWER_N3DBM      0x23
#define OUTPUT_POWER_N5DBM      0x25
#define OUTPUT_POWER_N7DBM      0x27
#define OUTPUT_POWER_N10DBM     0x2A
#define OUTPUT_POWER_N15DBM     0x2F
#define OUTPUT_POWER_N25DBM     0x39

// MAC PIB Attributes

------------------------------------------------------------

you can see, the output power max just set to 0dBm. so, please help how to set the output power to 4.5dBm

I regard the data sheet that set the outpower to 4.5dBm is just set the TXPOWER=0xF5, but I can't find how to process is at Z_stack, please give your great help. thanks.

 

BestRegard.Yihua

  • For Z-stack 2.3.0 with cc2530, I just use the following API to set the value directly.

    MAC_MlmeSetReq( ZMacPhyTransmitPower, &level );

    It seems ok as the register setting in the debugger verifies this.

    For older stack, the line //#define HAL_MAC_USE_REGISTER_POWER_VALUES shouldn't be commented out.

     

  • Hi Leo,

    Very thanks, but need your great help more, I found the API as extern ZMacStatus_t ZMacSetTransmitPower( ZMacTransmitPower_t level ); at ZMAC.h, but I don't know how to use it at where and when.

    I regard that the Sensor Demo project just set the output powre at 1dBm, the TXPOWER=0xD5 as follow:

     

    BestRegard.Yihua

  • arghh...

    both function are the same usage......

     

    -----------------------------------------------------

    uint8 TxValue = 0xF5;

    MAC_MlmeSetReq( ZMacPhyTransmitPower, &TxValue );

    ------------------------------------------------------

    Only do it after ZMac Initialization.

     

  • Hi, I have a similar problem.

    I want to reduct  the output power ( for well testing the multi-hop).

    ------

    I've tried to use

    MAC_MlmeSetReq( ...)

    after the

    ZMacInit();

    just before

    osal_start_system();

    in Zmain.C.

    But It doesn't work.

    -----

    I starded using

    ZMacSetTransmitPower(...)

    defined in ZMAC.h, and then I've looking inside the "low-level files".

    I've found the 

    macRadioSetTxPower(...)

    function. But It doesn't work.

    The last idea was modified the

    #define MAC_RADIO_TX_POWER_DEFAULT

    Isn't the best solution, but only for testing....

    --------

    But It still doesn't work, any Idea ?

    Thanks

     

     


  • Uncomment #Define HAL_MAC_USE_REGISTER_POWER_VALUES

    in mac_radio_def.h to allow the use of register values to set Tx Power.


    Then use following code line to set transmit power:

    MAC_MlmeSetReq(MAC_PHY_TRANSMIT_POWER_SIGNED, &txValue);

     

    (txValue = 0xF5 for 4.5dBm)

     

    This should solve your problem.

  • what i notice that..

    The line #define hal_mac... blahblahblah should be uncommented for stack ver <2.2.2

    It should not be uncommneted for stack ver >= 2.3.0...

  • Well as I recall:

    • If MAC_MlmeSetReq(MAC_PHY_TRANSMIT_POWER_SIGNED, &txValue) is used to set TxPower as I suggested you have to un-comment #Define HAL_MAC_USE_REGISTER_POWER_VALUES to be able to use register values. This function is commonly used when setting tx power in TIMAC (also embedded as MAC layer in Z-stack?)
    • With Z-stack you should use ZMacSetTransmitPower(ZmacTransmitPower_r level) and as you say Leo, not uncomment, because there are defines to use for the different TxPowers.

    However, I uncommented the define and used the first alternative just because in my case it worked, not saying anything is right or wrong. I tried different methods, but this one was the only one working for the higher outputs. I could add that this is what I believe a temporarily solution to the problem, and not the most beautiful usage of the Z-stack.

    (I am currently using 2.3.0)

  • HI,

    you can change the code as follows("mac_radio_defs.h"):

    1.TxPower = 0xF5

    /* register value table offset */
    #define MAC_RADIO_DEFS_TBL_TXPWR_FIRST_ENTRY   0
    #define MAC_RADIO_DEFS_TBL_TXPWR_LAST_ENTRY    0
    #define MAC_RADIO_DEFS_TBL_TXPWR_ENTRIES            2

    2.TxPower = 0xE5

    /* register value table offset */
    #define MAC_RADIO_DEFS_TBL_TXPWR_FIRST_ENTRY   0
    #define MAC_RADIO_DEFS_TBL_TXPWR_LAST_ENTRY    1
    #define MAC_RADIO_DEFS_TBL_TXPWR_ENTRIES            0

    3.TxPower = 0xD5

    /* register value table offset */
    #define MAC_RADIO_DEFS_TBL_TXPWR_FIRST_ENTRY   0
    #define MAC_RADIO_DEFS_TBL_TXPWR_LAST_ENTRY    1
    #define MAC_RADIO_DEFS_TBL_TXPWR_ENTRIES            2