ANT_SEL pin of nRF21540 using nRF Connect SDK

Hi,

we have a Gateway board that uses the nRF52832 with the nRF21540.

The firmware running on the nRF52832 is a slightly modified version of the HCI UART sample found in the nRF Connect SDK.

We have created the new board files (dts etc.) for porting the HCI UART firmware on our board and everything is working correctly (the firmware compiles correctly and the HCI UART is working and I am able to see advertising packets coming when I start a scan procedure).

Our hardware has 2 antennas, connected to the nRF21540, 1 internal antenna and 1 external antenna (with uFL connector).

I would like to build 1 firmware that use the internal antenna and 1 firmware that use the external antenna (for 2 different products that shares the same board).

The DTS file for the board that I have created is the following:

/dts-v1/;
#include <nordic/nrf52832_qfaa.dtsi>
#include "tinygateway_flex-pinctrl.dtsi"

/ {
	model = "Custom Board auto generated by nRF Connect for VS Code";
	compatible = "BlueUp,tinygateway-flex";
	
	chosen {
		zephyr,console = &uart0;
		zephyr,shell-uart = &uart0;
		zephyr,uart-mcumgr = &uart0;
		zephyr,bt-mon-uart = &uart0;
		zephyr,bt-c2h-uart = &uart0;
		zephyr,sram = &sram0;
		zephyr,flash = &flash0;
		zephyr,code-partition = &slot0_partition;
	};
	
	leds {
		compatible = "gpio-leds";

		led0: led_0 {
			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
			label = "Blue LED 0";
		};
	};
	
	nrf_radio_fem: nrf21540_fem {
		compatible = "nordic,nrf21540-fem";
		tx-en-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
		rx-en-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
		pdn-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
		ant-sel-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
		mode-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
		spi-if = <&nrf_radio_fem_spi>;
		supply-voltage-mv = <3000>;
	};
	
	/* These aliases are provided for compatibility with samples */
	aliases {
		led0 = &led0;
	};
};

&reg {
	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};

&adc {
	status = "okay";
};

&uicr {
	gpio-as-nreset;
};

&gpiote {
	status = "okay";
};

&gpio0 {
	status = "okay";
};

&uart0 {
	compatible = "nordic,nrf-uarte";
	status = "okay";
	current-speed = <115200>;
	pinctrl-0 = <&uart0_default>;
	pinctrl-1 = <&uart0_sleep>;
	pinctrl-names = "default", "sleep";
};

fem_spi: &spi0 {
	status = "okay";
	cs-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
	pinctrl-0 = <&spi0_default>;
	pinctrl-1 = <&spi0_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>;
};

&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 DT_SIZE_K(48)>;
		};

		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000c000 DT_SIZE_K(220)>;
		};

		slot1_partition: partition@43000 {
			label = "image-1";
			reg = <0x00043000 DT_SIZE_K(220)>;
		};

		storage_partition: partition@7a000 {
			label = "storage";
			reg = <0x0007a000 DT_SIZE_K(24)>;
		};
	};
};

In the Kconfig files I did not see any reference to the antenna selection, so my question is: how should I select the antenna to use for the nRF21540?

Thanks for the support.

BR,

Samuele.

Parents Reply Children
Related