NCS: Softdevice+Mesh+Ext. Advertising -> TX Power Control?

Hello,

I have trouble again with TX Power control. This time using Softdevice Controller and NCS2.6.0.

Previous issue which was solved (this was using Zephyr Controller):  NCS Mesh: TX Power register value does not change when changing TX Power via HCI 

Is there a common solution to control TX Power runtime, when running Mesh + Extended Advertising and Softdevice controller?

Thanks in advance! :)

Parents
  • Hi mesh777,

    You should be able to control the TX Power following the method demonstrated in the Bluetooth: HCI Power Control sample.

    Please note that the SoftDevice Controller only raise the TX Power momentarily for the radio action, and then will set it back to 0. A crude way I used to confirm things are working is to repeatedly print out the content of the TXPOWER register.

    Hieu

  • Please note that the SoftDevice Controller only raise the TX Power momentarily for the radio action, and then will set it back to 0

    What is the reason of such behaviour? Does it mean that TX Power needs to be reconfigured continuously or it is handled by Softdevice automatically?

    The reference sample does not take into account multiple AVD sets, when EXT ADV is enabled. Maybe Conn Handle somehow can be determined to configure each set?

  • Thanks for rapid response.

    1. Can you please explain why Softdevice is altering TX Power on its own, after its configured by the user once?

    2. Dynamic setting would allow user to reconfigure TX Power, this is not a must but nice to have feature. Also dynamic setting allow to have chip dependent configuration, e.g. 52832 does not have 8dbm, therefore its configured for 4dbm in our case.

    3. Static configuration does not work neither. It sets expected value to the register once, and later 0dBm is read back from the register all the time. I tried following conf:

    CONFIG_BT_CTLR_TX_PWR_ANTENNA=8
    CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
    So we are stuck with 0dBm at the moment :(
  • mesh777 said:
    1. Can you please explain why Softdevice is altering TX Power on its own, after its configured by the user once?

    It makes more sense if you think of it as "the user requests the SoftDevice Controller to use this TX Power for that connection/advertising handle; and the SoftDevice then serves that request appropriately by changing TX Power when it's time to serve that handle."

    At no point does the SoftDevice change this requested power. When the radio transmits, the TX Power will be raised to the appropriate value.

    If you configure request different handles to different TX Power, the Controller will also get that done.

    mesh777 said:
    2. Dynamic setting would allow user to reconfigure TX Power, this is not a must but nice to have feature. Also dynamic setting allow to have chip dependent configuration, e.g. 52832 does not have 8dbm, therefore its configured for 4dbm in our case.

    Thank you. This is a very reasonable feature. We have registered it and will look into it. Unfortunately, it is quite tricky to realize this with the way the mesh layers interact, so it might be difficult.

    mesh777 said:

    3. Static configuration does not work neither. It sets expected value to the register once, and later 0dBm is read back from the register all the time. I tried following conf:

    CONFIG_BT_CTLR_TX_PWR_ANTENNA=8
    CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
    So we are stuck with 0dBm at the moment :(

    I just tried with the Mesh Light sample, and it does work. I do see that just printing out TXPOWER rapidly doesn't work nearly as well as I once remember. Perhaps it worked better with BLE applications where the radio time is longer.

    For Mesh, I tweak the logic a little like below and I can observe TXPOWER does get set to 8. You could also use debugging to stop the execution at certain point to confirm the register value.

    int main(void)
    {
    	int err;
    
    	printk("Initializing...\n");
    
    	err = bt_enable(bt_ready);
    	if (err) {
    		printk("Bluetooth init failed (err %d)\n", err);
    	}
    
    	while (1)
    	{
    		int txpower = NRF_RADIO->TXPOWER;
    		if (txpower > 0) printk("TX power: %d\n", txpower);
    		static int cnt;
    		if (cnt > 50000)
    		{
    			static int cnt2;
    			printk("cnt2: %d\n", cnt2++);
    			cnt = 0;
    		}
    		k_sleep(K_MSEC(1));
    	}
    
    	return 0;
    }

    If you want absolute proof that it works, I recommend using a spectrum analyzer and look into the radio output directly.

  • Many thanks for clarification.

    I noticed that most of the time TX Power register is 0dBm, with the static config set which mentioned above.

    Does it mean that TX power setting is applied not to all handles? To which it is applied then?

    In your sample code you do not print value of 0 by the way, otherwise it is 0 most of the time.

  • CONFIG_BT_CTLR_TX_PWR_ANTENNA and the CONFIG_BT_CTLR_TX_PWR configuration line sets the default TX Power for all activities.
    Therefore, without a runtime reconfiguration, the SoftDevice Controller should use the configured default.
    Also note that the CONFIG_BT_CTLR_TX_PWR choices depends on CONFIG_BT_CTLR_TX_PWR_ANTENNA being not set. If the _ANTENNA configuration is set, it takes priority.
    mesh777 said:
    In your sample code you do not print value of 0 by the way, otherwise it is 0 most of the time.

    Yes, I too find that it is 0 for the absolutely vast majority of the time and can't figure out a good way to see the few "8\n" among the hundreds of "0\n," so I set up that logic instead.

    I guess if we really want to, we could also set a logic to get the statistic on how often and for how long TXPOWER stays in a particular value.

  • CONFIG_BT_CTLR_TX_PWR_ANTENNA and the CONFIG_BT_CTLR_TX_PWR configuration line sets the default TX Power for all activities.
    Yes, I too find that it is 0 for the absolutely vast majority of the time

    These two things sounds contradicting in my opinion, if all activities set to happen with 8dbm, then why most of the time register is set to 0dBm?

  • Reply Children
    Related