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.

MAC Tx power set in CC2530(Z stack 2.5.0)

Other Parts Discussed in Thread: MSP430F2618, CC2590, CC2530

In MAC init,

MAC_INTERNAL_API void macRadioInit(void)
{
  /* variable initialization for this module */
  reqChannel    = MAC_RADIO_CHANNEL_DEFAULT;
  macPhyChannel = MAC_RADIO_CHANNEL_INVALID;
  reqTxPower    = MAC_RADIO_TX_POWER_INVALID;
  macPhyTxPower = MAC_RADIO_TX_POWER_INVALID;
}

Is it set as the lowest Tx power? Or it means the Tx power is set somewhere else?

If we want to set Tx power at start stage and never change it later, what could be the best place? this init function?

Thanks

Rui

  • By Checking using Debugger, I believe TXPOWER is set to 0xD5? but the code set it to 0xFF? I am not sure what is wrong with me?

    Rui

  • It is not a good design practice to change central files like MAC, etc. For board-specific or application-specific changes, put them in a board-specific or application-specific place. So an example of a board-specific place to change the Tx power once in the lifetime is here:

      // Final board initialization
      InitBoard( OB_READY );

    i.e. in the InitBoard() function when the parameter is !OB_COLD

    An example of an application-specific place to change the Tx power once in the lifetime is in the task initialization, so here:

    void GenericApp_Init( uint8 task_id )

    You will change the Tx power using the highest level API possible, in this case, ZMac:

    ZMacSetTransmitPower(TX_PWR_MINUS_7);

    as an example.

  • Thanks Harry:

    There are different places to adjust Tx power, in PHY and in MAC layer respectively, and they seems to use different table?

    At least I found ZMacTransmitPower_t which is a enum, and macRadioDefsTxPwrBare[] which is Tx lookup table.

    And what is the difference between MAC_PHY_TRANSMIT_POWER_SIGNED and MAC_PHY_TRANSMIT_POWER?

    I am a little bit confused by those, so if there is any unified API(ZMacSetTransmitPower as in your example?), If I want to simply set Tx to max 4.5dbm, which value should I put?

    Thanks'

    Rui

  • As I said, Mr. Zhang:

    You will change the Tx power using the highest level API possible, in this case, ZMac:

    ZMacSetTransmitPower(TX_PWR_MINUS_7);

    The highest level API possible is de facto the "unified API" that you desire - don't confuse yourself by looking lower than you need to in order to solve your problem.

     

  • Thanks, I just feel that ZMacTransmitPower_t is little bit confusing compared with the table, for example, TX_PWR_PLUS_19 indicates it is 19, and since it is -1dbm unit, so it is actually -19dbm? then largest Tx power could be TX_PWR_MINUS_22 = 22dbm? However, the max Tx is 4.5dbm, right?

    I just don't understand the match between the value and real Tx power.

    Thanks

    Rui

  • hi here i added my changed codei. i didnt get the result

    and i downloaded the program in demo EB mode ...

    uint8 ZMacSetTransmitPower( ZMacTransmitPower_t TX_PWR_MINUS_18 )
    {
    return MAC_MlmeSetReq( ZMacPhyTransmitPowerSigned, &TX_PWR_MINUS_18 );
    }

    i// just changer TX_PWR_MINUS_18


    typedef enum
    {
    TX_PWR_MINUS_22 = -22,
    TX_PWR_MINUS_21,
    TX_PWR_MINUS_20,
    TX_PWR_MINUS_19,
    TX_PWR_MINUS_18 = -18,
    TX_PWR_MINUS_17,
    TX_PWR_MINUS_16,
    TX_PWR_MINUS_15,
    TX_PWR_MINUS_14,
    TX_PWR_MINUS_13,
    TX_PWR_MINUS_12,
    TX_PWR_MINUS_11,
    TX_PWR_MINUS_10,
    TX_PWR_MINUS_9,
    TX_PWR_MINUS_8,
    TX_PWR_MINUS_7,
    TX_PWR_MINUS_6,
    TX_PWR_MINUS_5,
    TX_PWR_MINUS_4,
    TX_PWR_MINUS_3,
    TX_PWR_MINUS_2,
    TX_PWR_MINUS_1,
    TX_PWR_ZERO,
    TX_PWR_PLUS_1,
    TX_PWR_PLUS_2,
    TX_PWR_PLUS_3,
    TX_PWR_PLUS_4,
    TX_PWR_PLUS_5,
    TX_PWR_PLUS_6,
    TX_PWR_PLUS_7,
    TX_PWR_PLUS_8,
    TX_PWR_PLUS_9,
    TX_PWR_PLUS_10,
    TX_PWR_PLUS_11,
    TX_PWR_PLUS_12,
    TX_PWR_PLUS_13,
    TX_PWR_PLUS_14,
    TX_PWR_PLUS_15,
    TX_PWR_PLUS_16,
    TX_PWR_PLUS_17,
    TX_PWR_PLUS_18,
    TX_PWR_PLUS_19
    } ZMacTransmitPower_t;

    please tell me wats the problem in it ?

  • Hi Lakshmanan,

    I would like to suggest you to use another API macRadioSetTxPower as the followings:

    /**************************************************************************************************
     * @fn          macRadioSetTxPower
     *
     * @brief       Set transmitter power of the radio.
     *
     * @param       txPower - the minus dBm for power but as a postive integer (or if configured
     *                        for it, txPower is the raw register value). If PA/LNA is installed
     *                        then txPower becomes positive dBm.
     *
     * @return      none
     **************************************************************************************************
    MAC_INTERNAL_API void macRadioSetTxPower(uint8 txPower)

  • hi yikai

    where i have to fetch these code ??

    in Zmac.c ?? or any other ?

  • Dear All

    I wanted to change the TX Power during the course of operation rather than fixing it in the beginning of application(using zstack for msp430f2618).

    Suggest the best way to do it.

    Adarsh

  • yup i found that API in mac- radio

    how i can change  the value ??

     for 2 meter wat is the TX power value ?

  • Hi Lakshmanan,

    This API is in mac_radio.c and I apply this API in my zcl_XXX_init() of zcl_xxx.c. If you are using SampleAPP, you would like to apply it in SampleApp_Init() of SampleApp.c.

  • Hi Lakshmanan,

    I have posted the meaning of parameter txPower. Re-post it in the followings:

     * @param       txPower - the minus dBm for power but as a postive integer (or if configured
     *                        for it, txPower is the raw register value). If PA/LNA is installed
     *                        then txPower becomes positive dBm.

  • hi yiki

    can i set value for txPower like this ?

    void SampleApp_Init( uint8 task_id )
    {
      SampleApp_TaskID = task_id;
      SampleApp_NwkState = DEV_INIT;
      SampleApp_TransID = 0;
    uint8 txPower = 0x45;

    }

    my device should transmit data with in 2 meter only

    by only this setting txPower= XXXX; will it be possible ???

    possible means ,can me tell me the value for XXXX for 2 meter ??

    thnks for ur advices ..

    i am a graduate student and new to this module too

  • Hi,

    For example, if your module is cc2530 with PA cc2590 on it, you can use "macRadioSetTxPower(16);" to set the txPower to 16dbm. If your device is only 2 meter away, why do you want to change txPower?

  •  have two base stations (CC2530 ) .. placed in separate room ... each base is allowed to transmit data with in  particular room ... for tat only i am designing cod e

  • hi

    i changed

    MAC_INTERNAL_API uint8 macRadioSetTxPower(18)

    in mc_radio .. here the errors i am getting

    Error while running C/C++ Compiler
    Error[Pe020]: identifier "txPower" is undefined C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\mac_radio.c 286
    Error[Pe020]: identifier "txPower" is undefined C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\mac_radio.c 277
    Error[Pe020]: identifier "txPower" is undefined C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\mac_radio.c 251
    Error[Pe141]: unnamed prototyped parameters not allowed when body is present C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\mac_radio.c 239
    Error[Pe147]: declaration is incompatible with "__banked_func __xdata_reentrant uint8 macRadioSetTxPower(uint8)" (declared at line 104 of "C:\Texas  C:\Texas Instruments\ZStack-CC2530-2.5.1a\Components\mac\low_level\srf04\mac_radio.c 239






  • Hi,

    You are not familiar with C programming, are you? If you want to set txPower to 18dbm, you need to insert "macRadioSetTxPower(18);" at where you want to change it.

  • i am new to this Z stack , cc2530 , smartfr05

    u r correct .. am a biomedical engg student .. i am not familiar with programming

    help to solve my prob

    tell me exactly where i have to change it :)

  • Which ZStack example do you use?

  • 1.Find the SampleApp_Init function, which should be at line 173 in the SampleApp.c

    2.Add a new line "macRadioSetTxPower(18);" after "aps_AddGroup( SAMPLEAPP_ENDPOINT, &SampleApp_Group );"

    This is all I can help.

  • hi still i cannot restrict the TX power ...help me ??

    am using sampleApp.c

  • PA stands for power amplifier.

    LNA stands for low noise amplifier.