Setting TX power with BT840XE

I have a few doubts regarding power macros and getting the result I want.

From combing through posts I have found the following:

Since BT840XE has a FEM, you need to properly represent them in the firmware using the following sections:

.dts

/ {
nrf_radio_fem: name_of_fem_node {
compatible = "skyworks,sky66112-11", "generic-fem-two-ctrl-pins";
ctx-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
crx-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
cps-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
chl-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
tx-gain-db = <x>;
rx-gain-db = <x>;
};
};

.
.
.

&radio {
fem = <&nrf_radio_fem>;
};

Kconfig at same level of prj.conf

config BOARD_ENABLE_FEM
bool "FEM enabled"
default y
select MPSL_FEM_GENERIC_TWO_CTRL_PINS_SUPPORT


prj.conf

CONFIG_MPSL=y
CONFIG_MPSL_FEM=y

and somewhere in my runtime, I need to use the following lines to enable the pins for transmit high power, since the driver only automatically enables the rx and tx

const struct device* gpio0_dev = device_get_binding("gpio@50000000"); // gpio 0

        gpio_pin_configure(gpio0_dev, 6, GPIO_OUTPUT); // gpio 0.06 - CPS
        gpio_pin_set(gpio0_dev, 6, 0);
        gpio_pin_configure(gpio0_dev, 8, GPIO_OUTPUT); // gpio 0.08 - CHL
        gpio_pin_set(gpio0_dev, 8, 1);


while you also have power macros like

CONFIG_BT_CTLR_TX_PWR_* that define which kind of dbm you want to use, positive,negative, and how much
CONFIG_BT_CTLR_TX_PWR_ANTENNA that defines how much power you want at the antenna and lets the software set the values for the nrf and fem based on that
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL that allows dynamic control of the tx power.

I want to use the +21bdm the bt840xe offers. I set tx-gain to 18, rx-gain to 11, following the specification, set the high tx mode using CPS and CHL, set 
CONFIG_BT_CTLR_TX_PWR_PLUS_3 and did not set CONFIG_BT_CTLR_TX_PWR_ANTENNA or CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL.

Since tx-gain and rx-gain don't actually control the gain,instead are used to inform the software regarding the gains from fem so it can adjust itself,and I want to divide between the nrf52840 and fem, since I read this is the way to do it to avoid overheating of the nrf52840,I did this way.

I wanted to confirm if what I did is correct


Parents
  • Hi Gus, 

    and somewhere in my runtime, I need to use the following lines to enable the pins for transmit high power, since the driver only automatically enables the rx and tx

    const struct device* gpio0_dev = device_get_binding("gpio@50000000"); // gpio 0

            gpio_pin_configure(gpio0_dev, 6, GPIO_OUTPUT); // gpio 0.06 - CPS
            gpio_pin_set(gpio0_dev, 6, 0);
            gpio_pin_configure(gpio0_dev, 8, GPIO_OUTPUT); // gpio 0.08 - CHL
            gpio_pin_set(gpio0_dev, 8, 1);

    Yes correct. 

    CONFIG_BT_CTLR_TX_PWR_* that define which kind of dbm you want to use, positive,negative, and how much
    CONFIG_BT_CTLR_TX_PWR_ANTENNA that defines how much power you want at the antenna and lets the software set the values for the nrf and fem based on that
    CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL that allows dynamic control of the tx power.

    I want to use the +21bdm the bt840xe offers. I set tx-gain to 18, rx-gain to 11, following the specification, set the high tx mode using CPS and CHL, set 
    CONFIG_BT_CTLR_TX_PWR_PLUS_3 and did not set CONFIG_BT_CTLR_TX_PWR_ANTENNA or CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL.

    Since tx-gain and rx-gain don't actually control the gain,instead are used to inform the software regarding the gains from fem so it can adjust itself,and I want to divide between the nrf52840 and fem, since I read this is the way to do it to avoid overheating of the nrf52840,I did this way.

    I wanted to confirm if what I did is correct

    My suggestion is only use CONFIG_BT_CTLR_TX_PWR_ANTENNA, by using that it will always try to use the lowest chip's TXPower combine with the TXgain of the FEM to achieve the desired CONFIG_BT_CTLR_TX_PWR_ANTENNA. So if you want +3 dBm on the chip you set tx-gain-db = CONFIG_BT_CTLR_TX_PWR_ANTENNA - 3

    Even if you don't configure CONFIG_BT_CTLR_TX_PWR_ANTENNA, it will get the value of 0 as the default. 
    See this ticket: nRF21540-DK how to get good results? 

Reply
  • Hi Gus, 

    and somewhere in my runtime, I need to use the following lines to enable the pins for transmit high power, since the driver only automatically enables the rx and tx

    const struct device* gpio0_dev = device_get_binding("gpio@50000000"); // gpio 0

            gpio_pin_configure(gpio0_dev, 6, GPIO_OUTPUT); // gpio 0.06 - CPS
            gpio_pin_set(gpio0_dev, 6, 0);
            gpio_pin_configure(gpio0_dev, 8, GPIO_OUTPUT); // gpio 0.08 - CHL
            gpio_pin_set(gpio0_dev, 8, 1);

    Yes correct. 

    CONFIG_BT_CTLR_TX_PWR_* that define which kind of dbm you want to use, positive,negative, and how much
    CONFIG_BT_CTLR_TX_PWR_ANTENNA that defines how much power you want at the antenna and lets the software set the values for the nrf and fem based on that
    CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL that allows dynamic control of the tx power.

    I want to use the +21bdm the bt840xe offers. I set tx-gain to 18, rx-gain to 11, following the specification, set the high tx mode using CPS and CHL, set 
    CONFIG_BT_CTLR_TX_PWR_PLUS_3 and did not set CONFIG_BT_CTLR_TX_PWR_ANTENNA or CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL.

    Since tx-gain and rx-gain don't actually control the gain,instead are used to inform the software regarding the gains from fem so it can adjust itself,and I want to divide between the nrf52840 and fem, since I read this is the way to do it to avoid overheating of the nrf52840,I did this way.

    I wanted to confirm if what I did is correct

    My suggestion is only use CONFIG_BT_CTLR_TX_PWR_ANTENNA, by using that it will always try to use the lowest chip's TXPower combine with the TXgain of the FEM to achieve the desired CONFIG_BT_CTLR_TX_PWR_ANTENNA. So if you want +3 dBm on the chip you set tx-gain-db = CONFIG_BT_CTLR_TX_PWR_ANTENNA - 3

    Even if you don't configure CONFIG_BT_CTLR_TX_PWR_ANTENNA, it will get the value of 0 as the default. 
    See this ticket: nRF21540-DK how to get good results? 

Children
Related