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,

    I will double check internally, but as far as I know CONFIG_BT_CTLR_TX_PWR_PLUS_3  will override CONFIG_BT_CTLR_TX_PWR_ANTENNA when you don't use FEM. 
    You can take a look at \nrf\subsys\bluetooth\controller\radio_nrf5_txp.h file, quoted here: 

    #if defined(CONFIG_BT_CTLR_TX_PWR_0) && CONFIG_BT_CTLR_TX_PWR_ANTENNA == 0
    #define RADIO_TXP_DEFAULT  0
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_10)
    #define RADIO_TXP_DEFAULT  10
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_8)
    #define RADIO_TXP_DEFAULT  8
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_7)
    #define RADIO_TXP_DEFAULT  7
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_6)
    #define RADIO_TXP_DEFAULT  6
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_5)
    #define RADIO_TXP_DEFAULT  5
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_4)
    #define RADIO_TXP_DEFAULT  4
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_3)
    #define RADIO_TXP_DEFAULT  3
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_2)
    #define RADIO_TXP_DEFAULT  2
    #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_1)
    #define RADIO_TXP_DEFAULT  1
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_1)
    #define RADIO_TXP_DEFAULT -1
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_2)
    #define RADIO_TXP_DEFAULT -2
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_3)
    #define RADIO_TXP_DEFAULT -3
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_4)
    #define RADIO_TXP_DEFAULT -4
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_5)
    #define RADIO_TXP_DEFAULT -5
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_6)
    #define RADIO_TXP_DEFAULT -6
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_7)
    #define RADIO_TXP_DEFAULT -7
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_8)
    #define RADIO_TXP_DEFAULT -8
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_9)
    #define RADIO_TXP_DEFAULT -9
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_10)
    #define RADIO_TXP_DEFAULT -10
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_12)
    #define RADIO_TXP_DEFAULT -12
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_14)
    #define RADIO_TXP_DEFAULT -14
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_16)
    #define RADIO_TXP_DEFAULT -16
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_20)
    #define RADIO_TXP_DEFAULT -20
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_26)
    #define RADIO_TXP_DEFAULT -26
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_30)
    #define RADIO_TXP_DEFAULT -30
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_40)
    #define RADIO_TXP_DEFAULT -40
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_46)
    #define RADIO_TXP_DEFAULT -46
    #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_70)
    #define RADIO_TXP_DEFAULT -70
    #else
    #define RADIO_TXP_DEFAULT CONFIG_BT_CTLR_TX_PWR_ANTENNA
    #endif
    


  • Is there some kind of sample code for specifically using fem and bt840xe for testing?

  • Hi Gus, 
    I don't think we have sample code for the specific module. But from what you showed it should work. Have you tried to measure the output power ? 
    Please try for example CONFIG_BT_CTLR_TX_PWR_ANTENNA=20 and measure the output power.

Reply Children
No Data
Related