Developing with the nRF21540 EK

The nRF21540 Evaluation Kit (EK) is an RF Front-End Module (FEM) for Bluetooth Low Energy, Bluetooth Mesh, 2.4 GHz proprietary, Thread, and Zigbee range extension. When combined with an nRF52 or nRF53 Series SoC, the nRF21540 RF FEM’s +21 dBm TX output power and 13 dB RX gain ensure a superior link budget for up to 16x range extension.

nRF21540EK

nRF21540 EK shield

You can learn more about the nRF21540 EK in the nRF21540 Front-End Module (including its pin layout) and nRF21540 EK User Guide hardware documentation.

Building and programming with nRF21540 EK

To build for the nRF21540 EK, build for the compatible nRF52 or nRF53 board target with the CMake SHIELD option set to nrf21540ek. See Providing CMake options for instructions on how to provide CMake options.

For example, if you build for nRF52840 DK on the command line, you can use the following command:

west build -b nrf52840dk/nrf52840 -- -DSHIELD=nrf21540ek

If you use the nRF Connect for VS Code extension, specify -DSHIELD=nrf21540ek in the Extra Cmake arguments field when setting up a build configuration.

Alternatively, add the shield in the project’s CMakeLists.txt file:

set(SHIELD nrf21540ek)

Building for a multicore board

When building for a board with an additional network core, like the nRF5340, add the -DSHIELD variable with the childImageName_ parameter between -D and SHIELD to build for the network core. In this case, the application core is only responsible for forwarding to the network core the pins needed to control the nRF21540 EK. The application core can be set up to forward the needed pins using the -DSHIELD=nrf21540ek_fwd setting. For example:

west build -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf21540ek_fwd -Dipc_radio_SHIELD=nrf21540ek

In this command, the childImageName_ parameter has the ipc_radio_ value as default and builds the application with support for the combination of 802.15.4 and Bluetooth. The ipc_radio has been used since the build system migration to sysbuild. See Migrating to sysbuild page. Setting the correct sysbuild option enables support for 802.15.4 and Bluetooth IPC radio firmware.

ipc_radio represents all applications with support for the combination of both 802.15.4 and Bluetooth. You can configure your application using the following sysbuild configurations:

  • SB_CONFIG_NETCORE_IPC_RADIO=y for applications having support for 802.15.4, but not for Bluetooth.

  • SB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y for application having support for Bluetooth, but not for 802.15.4.

  • SB_CONFIG_NETCORE_IPC_RADIO=y and SB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y for multiprotocol applications having support for both 802.15.4 and Bluetooth.

Note

On nRF53 devices, SPIM0 and UARTE0 are mutually exclusive AHB bus masters on the network core as described in the Product Specification, Section 6.4.3.1, Table 22. As a result, they cannot be used simultaneously. For the SPI part of the nRF21540 interface to be functional, you must disable the UARTE0 node in the network core’s devicetree file.

&uart0 {
   status = "disabled";
};