this is my prj conf
# Bluetooth
CONFIG_BT=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=n
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Range extender"
CONFIG_BT_SETTINGS=n
# MPSL and FEM
# Enable FEM and MPSL
CONFIG_MPSL=y
CONFIG_MPSL_FEM=y
CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
CONFIG_MPSL_FEM_POWER_MODEL=y
CONFIG_MPSL_FEM_POWER_MODEL_NRF21540_USE_BUILTIN=y
# GPIO for FEM
CONFIG_GPIO=y
CONFIG_MAIN_STACK_SIZE=2048
# Logging
CONFIG_LOG=y
this my Fem confg
nrf_radio_fem: nrf21540_fem {
compatible = "nordic,nrf21540-fem";
tx-en-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
rx-en-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
pdn-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
ant-sel-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
mode-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
spi-if = <&nrf_radio_fem_spi>;
supply-voltage-mv = <3000>;
};
fem_spi: &spi3 {
status = "okay";
cs-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
nrf_radio_fem_spi: nrf21540_fem_spi@0 {
compatible = "nordic,nrf21540-fem-spi";
status = "okay";
reg = <0>;
spi-max-frequency = <8000000>;
};
};
&radio {
fem = <&nrf_radio_fem>;
};
In my mai.c iam using
MPSL_FEM for
#include <mpsl_fem_protocol_api.h> with
#ifdef CONFIG_MPSL_FEM
configure_fem_gain(20); // Try full TX
#endif
#ifdef CONFIG_MPSL_FEM
static void configure_fem_gain(int8_t desired_dbm)
{
mpsl_tx_power_split_t split;
int8_t actual = mpsl_fem_tx_power_split(desired_dbm, &split, 2402, true);
printk("Requested TX: %d dBm, Actual: %d dBm\n", desired_dbm, actual);
if (mpsl_fem_pa_power_control_set(split.fem_pa_power_control)) {
printk("FEM gain config failed\n");
} else {
printk("FEM gain applied\n");
}
}
#endif
and i also get log properly
*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
Starting Eddystone Beacon with nRF21540 FEM
HF Clock started
[00:00:00.002,258] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
2d 79 a1 c8 6a 40 b7 3c f6 74 f9 0b 22 d3 c4 80 |-y..j@.< .t.."...
74 72 82 ba |tr..
[00:00:00.004,150] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.004,180] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.004,211] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 45.41337 Build 3074452168
[00:00:00.004,974] <inf> bt_hci_core: Identity: DC:EE:94:3E:21:82 (random)
[00:00:00.005,004] <inf> bt_hci_core: HCI: version 6.0 (0x0e) revision 0x106b, manufacturer 0x0059
[00:00:00.005,035] <inf> bt_hci_core: LMP: version 6.0 (0x0e) subver 0x106b
Bluetooth initialized
Requested TX: 4 dBm, Actual: 6 dBm
FEM gain applied
Beacon advertising as DC:EE:94:3E:21:82 (random)
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
Starting Eddystone Beacon with nRF21540 FEM
HF Clock started
[00:00:00.002,258] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
2d 79 a1 c8 6a 40 b7 3c f6 74 f9 0b 22 d3 c4 80 |-y..j@.< .t.."...
74 72 82 ba |tr..
[00:00:00.004,150] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.004,180] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.004,211] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 45.41337 Build 3074452168
[00:00:00.004,974] <inf> bt_hci_core: Identity: DC:EE:94:3E:21:82 (random)
[00:00:00.005,004] <inf> bt_hci_core: HCI: version 6.0 (0x0e) revision 0x106b, manufacturer 0x0059
[00:00:00.005,035] <inf> bt_hci_core: LMP: version 6.0 (0x0e) subver 0x106b
Bluetooth initialized
Requested TX: 4 dBm, Actual: 6 dBm
FEM gain applied
Beacon advertising as DC:EE:94:3E:21:82 (random)
I also used both antennas for safety. I tested with mode set to high and low, and with ANT_SEL set to high and low. and also i cross check my hardware pins it is proper