Setting the TX Power and checking it in the terminal

Hello

I'm working with the nRF21540 and the nRF Connect SDK 2.6.2.

I would like to set my TX Power to 20 dBm and also check this value. Currently my configuration looks like this:

CONFIG_BT=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV=y
CONFIG_BT_DEVICE_NAME="PAwR adv sample"

CONFIG_BT_MAX_CONN=1
CONFIG_BT_CENTRAL=y
CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y

CONFIG_BT_PER_ADV_RSP=y

CONFIG_BT_REMOTE_INFO=y
CONFIG_BT_GATT_CLIENT=y

CONFIG_LOG=y

CONFIG_BT_CTLR=y

# floating-point support
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# PHY
CONFIG_BT_CTLR_PHY_2M=y

# FEM
CONFIG_MPSL=y
CONFIG_MPSL_FEM=y
CONFIG_MPSL_FEM_NRF21540_GPIO=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
CONFIG_BT_CTLR_TX_PWR_ANTENNA=20

# RSSI 
CONFIG_BT_CTLR_CONN_RSSI=y

Unfortunately, I don't know if that's correct. I tried to test the value as follows:

static void response_cb(struct bt_le_ext_adv *adv, struct bt_le_per_adv_response_info *info,
		     struct net_buf_simple *buf)
{
	if (buf) {
		printk("Response: subevent %d, slot %d\n", info->subevent, info->response_slot);
		bt_data_parse(buf, print_ad_field, info);
		printk("RSSI: %d dBm\t", info->rssi);
		printk("TX Power: %d dBm\n", info->tx_power);
		increment_responses();
		
	} else {
		printk("Failed to receive response: subevent %d, slot %d\n", info->subevent,
		       info->response_slot);
		
	}
	
	
}

If I output the value for the TX Power, I always get a value of 127, the RSSI value is in a range between -17 and -22 dBm.

Is there something wrong with this in general or how can I set the TX Power to 20 dBm and then check it?

Thank you and best regards,

Alexandra

Related