Programming a board with custom connections

nRF21540 DK Hardware

For boards with custom pin connections for programming and debugging, use debug output on connector P20.

Connect the boards as shown in the following figure.

Figure 1. Connecting an external board to P20
nRF21540 DK Connecting a custom board with custom connections to P20

It is recommended to power the external board separately from the DK. The voltage on the external board must match that of the DK. When the DK is powered through the USB connector, the voltage is 3 V.

When the interface MCU detects the voltage of the external board on pin 3 (SWD1_VTG) of P20 it programs or debugs the target chip on the external board instead of the onboard nRF52840 System on Chip (SoC). If the interface MCU detects boards connected to both P19 and P20, it programs or debugs the target connected to P19 by default.

The following figure shows the pinout of the P20 connector.

Figure 2. Debug output connector P20
Debug output connector P20 on nRF21540 DK

The following table describes the pinout of the P20 connector.

Table 1. Header P20 pinout for programming external targets
Pin number Signal Description
1 VDD_nRF Application power domain for current measurement
2 VDD_nRF´ Main power domain
3 SWD1_VTG Debug out select signal, connect to target voltage on external board
4 SWD1_SWDIO Serial Wire Debug (SWD) I/O line
5 SWD1_SWDCLK Serial wire clock line
6 SWD1_SWO Serial Wire Output (SWO) line is not used for programming and debugging over SWD
7 SWD1_RESET Reset line
8 N.C. Not used
9 VIN3-5V Voltage supply
10 VDD_nRF_HV nRF21540 DK VBAT power domain for current measurement
11 VDD_nRF_HV´ Main VBAT power domain
12 VIO_REF GPIO voltage reference input
13 BOARD_ID DK ID resistor

The function of pin 2 (VDD_nRF´) depends on the positions of switches SW9 and SW10 as described by the following table.

Table 2. Function of pin 2 (VDD_nRF´)
Position SW9 Position SW10 Description
VDD OFF Main nRF21540 DK power domain
VDD ON The pin is connected to the external power supply connector P21
Li-Po or USB OFF or ON The output voltage from the on-chip regulator of nRF52840

Supply power to an external board through the DK

If there is no separate power supply on the external board, the nRF21540 DK can supply power through pin 2 (VDD_nRF') of P20.
  1. Ensure that SW9 is in the VDD position.
  2. Ensure that SW10 is in the OFF position.
  3. Connect power to external board on pin 2 (VDD_nRF') of connector P20 as shown with a grey outline in Connecting an external board to P20.
CAUTION:
To avoid overloading the power supply and damaging the DK, use VDD and keep the supply below 100 mA. Do not use a Lithium-polymer (Li-Poly) source.
CAUTION:
To avoid damaging your board, do not connect a separate power supply to the external board when VDD of the nRF21540 DK is connected to the external board and follow the instructions carefully.