Good Day!
I am trying to connect and configure an nRF21540 FEM to my own board which uses an nRF52840 microcontroller.
(SDK v2.5.99, Toolchain v2.5)
I am using the MPSL library and SPI/GPIO connection mode for the setup.
My prj.conf (code part related to 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
My custom_board_nrf52840.dts (code part related to FEM) -->
/ { model = "custom board nRF52840"; compatible = "nordic-semiconductor,custom-board-nrf52840"; nrf_radio_fem: nrf21540_fem_node { compatible = "nordic,nrf21540-fem"; tx-en-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; rx-en-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; pdn-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; spi-if = <&nrf_radio_fem_spi>; }; }; &radio { fem = <&nrf_radio_fem>; };
My custom_board_nrf52840-pinctrl.dtsi (code part related to FEM) -->
&pinctrl {
spi0_default_alt: spi0_default_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 6)>,
<NRF_PSEL(SPIM_MISO, 1, 12)>,
<NRF_PSEL(SPIM_MOSI, 1, 13)>;
};
};
spi0_sleep_alt: spi0_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 6)>,
<NRF_PSEL(SPIM_MISO, 1, 12)>,
<NRF_PSEL(SPIM_MOSI, 1, 13)>;
low-power-enable;
};
};
};
fem_spi: &spi0 {
status = "okay";
pinctrl-0 = <&spi0_default_alt>;
pinctrl-1 = <&spi0_sleep_alt>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
nrf_radio_fem_spi: nrf21540_fem_spi@0 {
compatible = "nordic,nrf21540-fem-spi";
status = "okay";
reg = <0>;
spi-max-frequency = <8000000>;
};
};
When I try to build the project I get the following errors (see screenshot) -->
Can you please tell me what this has to do with?
I also have the following questions:
1. What libraries should be included with the main.c file to work with FEM?
2. Is it necessary to separately connect the library for working with SPI in main.c? Or it will be connected automatically when SPI/GPIO mode is enabled?
3. Where can I find and familiarize myself with the functions needed to work with the FEM?
4. Is there a simple example project that shows how to work with the nRF21540? I have looked at two projects (Radio test (short-range) and Bluetooth: Direct Test Mode), but I found them incomprehensible in terms of FEM control. I found it difficult to navigate through so much program code.
I hope for your understanding and your help.
Thank you.