CC2340R5: Change the RF transmit power based on the ZBOSS protocol stack

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

void zb_get_tx_power_async(zb_bufid_t param);

void zb_set_tx_power_async(zb_bufid_t param);

I think the above API interface can set the transmission power of zigbee, but I do not know how to use it.

  • Hi,

    Here is an example to get you started.

    In MAIN() before zb_set_nvram_erase_at_start():

    zb_buf_get_out_delayed(set_tx_power);

    Above MAIN():

    #define ZB_CHANNEL 17
    #define TX_POWER   0
    
    void tx_power_cb(zb_bufid_t param)
    {
      zb_tx_power_params_t *power_params = zb_buf_begin(param);
    
      Log_printf(LogModule_Zigbee_App, Log_INFO, ">> tx_power_cb status %hd", power_params->status);
    
      switch (power_params->status)
      {
        case RET_OK:
          Log_printf(LogModule_Zigbee_App, Log_INFO,
                    "tx_power op successful, channel %hd page %hd power %hd",
                    power_params->channel, power_params->page, power_params->tx_power);
          break;
    
        case RET_INVALID_PARAMETER_3:
          Log_printf(LogModule_Zigbee_App, Log_INFO,
                    "tx_power op invalid tx power, current value for channel %hd page %hd - %hd",
                    power_params->channel, power_params->page, power_params->tx_power);
          break;
    
        case RET_INVALID_PARAMETER_1:
        case RET_INVALID_PARAMETER_2:
          Log_printf(LogModule_Zigbee_App, Log_ERROR, "tx_power op invalid channel or page");
          break;
    
        default:
          Log_printf(LogModule_Zigbee_App, Log_ERROR, "tx_power op unknown status");
          break;
      }
    
      zb_buf_free(param);
    }
    
    void get_tx_power(zb_bufid_t param)
    {
      zb_tx_power_params_t *power_params;
    
      power_params = zb_buf_initial_alloc(param, sizeof(zb_tx_power_params_t));
    
      power_params->page = ZB_CHANNEL_PAGE0_2_4_GHZ;
      power_params->channel = ZB_CHANNEL;
      power_params->cb = tx_power_cb;
    
      ZB_SCHEDULE_APP_CALLBACK(zb_get_tx_power_async, param);
    }
    
    void set_tx_power(zb_bufid_t param)
    {
      zb_tx_power_params_t *power_params;
    
      Log_printf(LogModule_Zigbee_App, Log_INFO, "param %hd", param);
    
      power_params = zb_buf_initial_alloc(param, sizeof(zb_tx_power_params_t));
    
      power_params->page = ZB_CHANNEL_PAGE0_2_4_GHZ;
      power_params->channel = ZB_CHANNEL;
      power_params->tx_power = TX_POWER;
      power_params->cb = tx_power_cb;
    
      ZB_SCHEDULE_APP_CALLBACK(zb_set_tx_power_async, param);
    }

    And as necessary in your application:

    zb_buf_get_out_delayed(get_tx_power);

    Hope this helps,
    Ryan

  • I modified the RF transmitting power according to the above method,However, using the spectrum analyzer to test the RF transmission power is still 0dbm.

  • Did you have the device join before trying to call set_tx_power, and did you modify TX_POWER accordingly?  Other options include using zb_mac_set_tx_power (be sure to include the mac_internal.h file) or re-defining ZB_TRANSCEIVER_SET_TX_POWER.

    Regards,
    Ryan

  • Hello,As shown in the picture above,set the transmit power before network initialization.

    I printf the log and it showed that the transmit power was set successfully,and read the transmit power by the ZB_TRANSCEIVER_GET_TX_POWER(&txpower) is 8dbm.

    But,the actual value tested by the spectrum analyzer is always 0dbm

  • Can you please confirm that you've tried all three methods, both before and after network commissioning?

    • zb_set_tx_power_async
    • zb_max_set_tx_power
    • ZB_TRANSCEIVER_SET_TX_POWER

    I can confirm similar from my end based on RSSI readings and will ask the Zigbee R&D Team to verify

    Regards,
    Ryan

  • I tried zb_max_set_tx_power() as well after network commissioning, it didn't work. I also need such API, looking forward to the reply from zigbee R&D Team.In addition, what is the range of the parameter power, -20 ~ 8?

  • Hi Senjin,

    TI is aware of the issue and currently investigating.  When functional, the TX power can be selected between one of the LRF_txPowerTable values available in the ti_radio_config.c file generated by SysConfig.

    // LRF_TxPowerTable data structure
    const LRF_TxPowerTable LRF_txPowerTable = {
        .numEntries = 0x0000000E,
        .powerTable = {
            { .power = { .fraction = 0, .dBm = -20 }, .tempCoeff = 0, .value = { .reserved = 0, .ib = 18, .gain = 0, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = -16 }, .tempCoeff = 0, .value = { .reserved = 0, .ib = 25, .gain = 0, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = -12 }, .tempCoeff = 5, .value = { .reserved = 0, .ib = 29, .gain = 1, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = -8 }, .tempCoeff = 18, .value = { .reserved = 0, .ib = 44, .gain = 1, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = -4 }, .tempCoeff = 28, .value = { .reserved = 0, .ib = 40, .gain = 3, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 0 }, .tempCoeff = 40, .value = { .reserved = 0, .ib = 21, .gain = 6, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 1 }, .tempCoeff = 65, .value = { .reserved = 0, .ib = 30, .gain = 6, .mode = 0, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 2 }, .tempCoeff = 41, .value = { .reserved = 0, .ib = 39, .gain = 4, .mode = 1, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 3 }, .tempCoeff = 43, .value = { .reserved = 0, .ib = 31, .gain = 5, .mode = 1, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 4 }, .tempCoeff = 50, .value = { .reserved = 0, .ib = 37, .gain = 5, .mode = 1, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 5 }, .tempCoeff = 55, .value = { .reserved = 0, .ib = 27, .gain = 6, .mode = 1, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 6 }, .tempCoeff = 75, .value = { .reserved = 0, .ib = 38, .gain = 6, .mode = 1, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 7 }, .tempCoeff = 80, .value = { .reserved = 0, .ib = 25, .gain = 7, .mode = 1, .noIfampRfLdoBypass = 0 } },
            { .power = { .fraction = 0, .dBm = 8 }, .tempCoeff = 180, .value = { .reserved = 0, .ib = 63, .gain = 7, .mode = 1, .noIfampRfLdoBypass = 0 } }
        }
    };

    Regards,
    Ryan

  • Hello all,

    The Tx power issue has been fixed in SIMPLELINK-LOWPOWER-F3-SDK v8.40.02.01, please download and re-evaluate with zb_mac_set_tx_power.

    Regards,
    Ryan

  • Hi Ryan,

    I have verified V8.40.02.01 firmware, BUG has been fixed. thanks very much