Hello,
nRF21540DK
which TX Power value is maximum for long rang?

void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl)
{
struct bt_hci_cp_vs_write_tx_power_level *cp;
struct bt_hci_rp_vs_write_tx_power_level *rp;
struct net_buf *buf, *rsp = NULL;
int err;
buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,sizeof(*cp));
if (!buf) {
printk("Unable to allocate command buffer\n");
return;
}
cp = net_buf_add(buf, sizeof(*cp));
cp->handle = sys_cpu_to_le16(handle);
cp->handle_type = handle_type;
cp->tx_power_level = tx_pwr_lvl;
err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,buf, &rsp);
if (err) {
uint8_t reason = rsp ?
((struct bt_hci_rp_vs_write_tx_power_level *)
rsp->data)->status : 0;
printk("Set Tx power err: %d reason 0x%02x\n", err, reason);
return;
}
rp = (void *)rsp->data;
printk("RADIO Tx Power: %d + PA_GAIN(%d) = %d\n", rp->selected_tx_power, CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB, rp->selected_tx_power + CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB);
net_buf_unref(rsp);
}
void main()
{
...
// set TX power
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, 0, RADIO_TXPOWER_TXPOWER_Pos8dBm);
...
}
Best Regards


