1# Copyright (c) 2020, 2021 Nordic Semiconductor ASA 2# SPDX-License-Identifier: Apache-2.0 3 4 5description: | 6 This is a representation of the nRF21540 Radio Front-End module. 7 8 See the "nordic,nrf21540-fem-spi" binding to configure the SPI 9 interface. The SPI interface should be configured as a child node 10 of the SPI bus you have connected to the FEM. Then you "connect" 11 the FEM and SPI configurations using the spi-if property. 12 13 Here is an example nRF21540 configuration with a SPI interface 14 selected, using the SPIM0 peripheral found on several nRF5 SoCs: 15 16 &spi0 { 17 compatible = "nordic,nrf-spim"; 18 status = "okay"; 19 cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; 20 /* ... MISO/MOSI/SCK pin configuration goes here ... */ 21 22 my_spi_if: nrf21540-spi@0 { 23 compatible = "nordic,nrf21540-fem-spi"; 24 reg = <0>; 25 spi-max-frequency = <8000000>; 26 }; 27 }; 28 29 nrf_radio_fem: nrf21540 { 30 compatible = "nordic,nrf21540-fem"; 31 tx-en-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; 32 rx-en-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; 33 spi-if = <&my_spi_if>; 34 pdn-gpios = <...>; 35 ant-sel-gpios = <...>; 36 mode-gpios = <...>; 37 /* ... other nRF21540 properties go here ... */ 38 }; 39 40 &radio { 41 fem = <&nrf_radio_fem>; 42 }; 43 44 In the above example, the nRF21540 is configured for use with: 45 46 - TX_EN on P0.2 (from 'tx-en-gpios') 47 - RX_EN on P0.5 (from 'rx-en-gpios') 48 - SPI communication via SPIM0 (the bus, or parent node, of 49 the 'my_spi_if' node 50 - CSN on P1.3 (from index 0 in the bus node's 'cs-gpios' property) 51 52 You must perform any additional required SPI pin configuration 53 (nRF21540 MISO, MOSI, and SCK pins) within the SPI bus node 54 ('spi0' in the above example). See your SPI node's binding for 55 details on these pin mux properties. You can use any SPI node 56 available in your SoC's devicetree. 57 58 Configure any other nRF21540 pins as needed using 'pdn-gpios', 59 'ant-sel-gpios', and 'mode-gpios' properties. If unsure about the 60 format, use 'tx-en-gpios' as an example. 61 62 Finally, the nRF5 SoC's radio peripheral is set up for use with 63 the nRF21540 via the 'fem' property in the 'radio' node. 64 65compatible: "nordic,nrf21540-fem" 66 67include: base.yaml 68 69properties: 70 tx-en-gpios: 71 type: phandle-array 72 description: | 73 GPIO of the SOC controlling TX_EN pin of the nRF21540 74 rx-en-gpios: 75 type: phandle-array 76 description: | 77 GPIO of the SOC controlling RX_EN pin of the nRF21540 78 pdn-gpios: 79 type: phandle-array 80 description: | 81 GPIO of the SOC controlling PDN pin of the nRF21540 82 ant-sel-gpios: 83 type: phandle-array 84 description: | 85 GPIO of the SOC controlling ANT-SEL pin of the nRF21540 86 mode-gpios: 87 type: phandle-array 88 description: | 89 GPIO of the SOC controlling MODE pin of the nRF21540 90 spi-if: 91 type: phandle 92 description: | 93 Reference to the nordic,nrf21540-fem-spi SPI bus interface. 94 95 This must be present to support SPI control of the FEM. 96 tx-en-settle-time-us: 97 type: int 98 default: 11 99 description: | 100 Settling time in microseconds from state PG to TX. 101 102 Default value is based on Table 6 of the nRF21540 Product 103 Specification (v1.0), and can be overridden for tuned 104 configurations. 105 rx-en-settle-time-us: 106 type: int 107 default: 11 108 description: | 109 Settling time in microseconds from state PG to RX. 110 111 Default value is based on Table 6 of the nRF21540 Product 112 Specification (v1.0), and can be overridden for tuned 113 configurations. 114 pdn-settle-time-us: 115 type: int 116 default: 18 117 description: | 118 Settling time in microseconds from state PD to PG. 119 120 Default value is based on Table 6 of the nRF21540 Product 121 Specification (v1.0), and can be overridden for tuned 122 configurations. 123 trx-hold-time-us: 124 type: int 125 default: 3 126 description: | 127 Power-off time in microseconds when changing from RX or TX to PG. 128 129 Default value is based on Table 6 of the nRF21540 Product 130 Specification (v1.0), and can be overridden for tuned 131 configurations. 132 supply-voltage-mv: 133 type: int 134 description: | 135 nRF21540 supply voltage in mV. 136 137 This is used if compensation for nRF21540 supply voltage is supported 138 by software. 139