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

  • Hi

    What RSSI do you see when you set the TX power lower on your end? Does it change at all or stay similar? Are you using the GPIO to set up the nRF21540 on your end? You can use the CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA to set the TX gain of the nRF21540. This defaults to 20dBm, so it might be set to 20 already in your case. Can you try setting it lower to see if the RSSI is notably lower on your end?

    Please also note that in the EU, 20 dBm is not allowed in commercial products, and a maximum of 10dBm is allowed. Just wanted to let you know that this is regulated. In markets like the US and some Asian countries this is fine though, I just wanted to let you know since you're located in the EU.

    Best regards,

    Simon

  • What RSSI do you see when you set the TX power lower on your end?
    If I set the Tx Power lower, the RSSI value gets worse (at 10 dBM RSSI: -25 to -30 and at 5 dBm RSSI: -35 to -40). The value also gets worse when I increase the distance and at -80 the connection usually breaks off.
    Are you using the GPIO to set up the nRF21540 on your end?

    Yes, and we only want to use GPIO and not SPI.

    Please also note that in the EU, 20 dBm is not allowed in commercial products, and a maximum of 10dBm is allowed. Just wanted to let you know that this is regulated. In markets like the US and some Asian countries this is fine though, I just wanted to let you know since you're located in the EU.

    Yes, we aware of that.

    Best regards,

    Alexandra

  • However, the RSSI value is worse when using CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA (RSSI -40dBm) than when I use CONFIG_BT_CTLR_TX_PWR_ANTENNA (RSSI -20 dBm).
  • Hi

    Okay, my bad. I thought the CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA would also set the TX power, but it just forwards the FEM status to the MPSL, and CONFIG_BT_CTLR_TX_PWR_ANTENNA should be the right config to set the actual TX output.

    So, then the next mystery is why you get the value of 127. This is the maximum, which points to an invalid value. That could be because the TX power you get from the scanner side isn't the TX power the kit sends with. I think you can use the following function to get the correct TX power here. https://docs.nordicsemi.com/bundle/ncs-2.4.1/page/nrfxlib/mpsl/doc/api.html#c.mpsl_fem_pa_is_configured 

    Best regards,

    Simon

Related