1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 * Copyright (c) 2017 Linaro Limited
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <nordic/nrf52840_qiaa.dtsi>
10#include "nrf21540dk_nrf52840-pinctrl.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "Nordic nRF21540 DK NRF52840";
15	compatible = "nordic,nrf21540-dk-nrf52840";
16
17	chosen {
18		zephyr,console = &uart0;
19		zephyr,shell-uart = &uart0;
20		zephyr,uart-mcumgr = &uart0;
21		zephyr,bt-mon-uart = &uart0;
22		zephyr,bt-c2h-uart = &uart0;
23		zephyr,sram = &sram0;
24		zephyr,flash = &flash0;
25		zephyr,code-partition = &slot0_partition;
26		zephyr,ieee802154 = &ieee802154;
27	};
28
29	leds {
30		compatible = "gpio-leds";
31		led0: led_0 {
32			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
33			label = "Green LED 0";
34		};
35		led1: led_1 {
36			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
37			label = "Green LED 1";
38		};
39		led2: led_2 {
40			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
41			label = "Green LED 2";
42		};
43		led3: led_3 {
44			gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
45			label = "Green LED 3";
46		};
47	};
48
49	pwmleds {
50		compatible = "pwm-leds";
51		pwm_led0: pwm_led_0 {
52			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
53		};
54	};
55
56	buttons {
57		compatible = "gpio-keys";
58		button0: button_0 {
59			gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
60			label = "Push button switch 0";
61			zephyr,code = <INPUT_KEY_0>;
62		};
63		button1: button_1 {
64			gpios = <&gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
65			label = "Push button switch 1";
66			zephyr,code = <INPUT_KEY_1>;
67		};
68		button2: button_2 {
69			gpios = <&gpio0 24 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
70			label = "Push button switch 2";
71			zephyr,code = <INPUT_KEY_2>;
72		};
73		button3: button_3 {
74			gpios = <&gpio0 25 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
75			label = "Push button switch 3";
76			zephyr,code = <INPUT_KEY_3>;
77		};
78	};
79
80	arduino_header: connector {
81		compatible = "arduino-header-r3";
82		#gpio-cells = <2>;
83		gpio-map-mask = <0xffffffff 0xffffffc0>;
84		gpio-map-pass-thru = <0 0x3f>;
85		gpio-map = <0 0 &gpio0 3 0>,	/* A0 */
86			   <1 0 &gpio0 4 0>,	/* A1 */
87			   <2 0 &gpio0 28 0>,	/* A2 */
88			   <3 0 &gpio0 29 0>,	/* A3 */
89			   <4 0 &gpio0 30 0>,	/* A4 */
90			   <5 0 &gpio0 31 0>,	/* A5 */
91			   <6 0 &gpio1 1 0>,	/* D0 */
92			   <7 0 &gpio1 2 0>,	/* D1 */
93			   <8 0 &gpio1 3 0>,	/* D2 */
94			   <9 0 &gpio1 4 0>,	/* D3 */
95			   <10 0 &gpio1 5 0>,	/* D4 */
96			   <11 0 &gpio1 6 0>,	/* D5 */
97			   <12 0 &gpio1 7 0>,	/* D6 */
98			   <13 0 &gpio1 8 0>,	/* D7 */
99			   <14 0 &gpio1 10 0>,	/* D8 */
100			   <15 0 &gpio1 11 0>,	/* D9 */
101			   <16 0 &gpio1 12 0>,	/* D10 */
102			   <17 0 &gpio1 13 0>,	/* D11 */
103			   <18 0 &gpio1 14 0>,	/* D12 */
104			   <19 0 &gpio1 15 0>,	/* D13 */
105			   <20 0 &gpio0 26 0>,	/* D14 */
106			   <21 0 &gpio0 27 0>;	/* D15 */
107	};
108
109	arduino_adc: analog-connector {
110		compatible = "arduino,uno-adc";
111		#io-channel-cells = <1>;
112		io-channel-map = <0 &adc 1>,	/* A0 = P0.3 = AIN1 */
113				 <1 &adc 2>,	/* A1 = P0.4 = AIN2 */
114				 <2 &adc 4>,	/* A2 = P0.28 = AIN4 */
115				 <3 &adc 5>,	/* A3 = P0.29 = AIN5 */
116				 <4 &adc 6>,	/* A4 = P0.30 = AIN6 */
117				 <5 &adc 7>;	/* A5 = P0.31 = AIN7 */
118	};
119
120	nrf_radio_fem: nrf21540_fem {
121		compatible = "nordic,nrf21540-fem";
122		tx-en-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
123		rx-en-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
124		pdn-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
125		ant-sel-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
126		mode-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
127		spi-if = <&nrf_radio_fem_spi>;
128		supply-voltage-mv = <3000>;
129	};
130
131	/* These aliases are provided for compatibility with samples */
132	aliases {
133		led0 = &led0;
134		led1 = &led1;
135		led2 = &led2;
136		led3 = &led3;
137		pwm-led0 = &pwm_led0;
138		sw0 = &button0;
139		sw1 = &button1;
140		sw2 = &button2;
141		sw3 = &button3;
142		bootloader-led0 = &led0;
143		mcuboot-button0 = &button0;
144		mcuboot-led0 = &led0;
145		watchdog0 = &wdt0;
146	};
147};
148
149&reg1 {
150	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
151};
152
153&adc {
154	status = "okay";
155};
156
157&uicr {
158	gpio-as-nreset;
159};
160
161&gpiote {
162	status = "okay";
163};
164
165&gpio0 {
166	status = "okay";
167};
168
169&gpio1 {
170	status = "okay";
171};
172
173&uart0 {
174	compatible = "nordic,nrf-uarte";
175	status = "okay";
176	current-speed = <115200>;
177	pinctrl-0 = <&uart0_default>;
178	pinctrl-1 = <&uart0_sleep>;
179	pinctrl-names = "default", "sleep";
180};
181
182arduino_serial: &uart1 {
183	current-speed = <115200>;
184	pinctrl-0 = <&uart1_default>;
185	pinctrl-1 = <&uart1_sleep>;
186	pinctrl-names = "default", "sleep";
187};
188
189arduino_i2c: &i2c0 {
190	compatible = "nordic,nrf-twi";
191	status = "okay";
192	pinctrl-0 = <&i2c0_default>;
193	pinctrl-1 = <&i2c0_sleep>;
194	pinctrl-names = "default", "sleep";
195};
196
197&i2c1 {
198	compatible = "nordic,nrf-twi";
199	/* Cannot be used together with spi1. */
200	/* status = "okay"; */
201	pinctrl-0 = <&i2c1_default>;
202	pinctrl-1 = <&i2c1_sleep>;
203	pinctrl-names = "default", "sleep";
204};
205
206&pwm0 {
207	status = "okay";
208	pinctrl-0 = <&pwm0_default>;
209	pinctrl-1 = <&pwm0_sleep>;
210	pinctrl-names = "default", "sleep";
211};
212
213&spi0 {
214	compatible = "nordic,nrf-spi";
215	/* Cannot be used together with i2c0. */
216	/* status = "okay"; */
217	pinctrl-0 = <&spi0_default>;
218	pinctrl-1 = <&spi0_sleep>;
219	pinctrl-names = "default", "sleep";
220};
221
222&spi1 {
223	compatible = "nordic,nrf-spi";
224	status = "okay";
225	pinctrl-0 = <&spi1_default>;
226	pinctrl-1 = <&spi1_sleep>;
227	pinctrl-names = "default", "sleep";
228};
229
230&spi2 {
231	compatible = "nordic,nrf-spi";
232	status = "disabled";
233	pinctrl-0 = <&spi2_default>;
234	pinctrl-1 = <&spi2_sleep>;
235	pinctrl-names = "default", "sleep";
236};
237
238fem_spi: &spi3 {
239	status = "okay";
240	cs-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
241
242	pinctrl-0 = <&spi3_default>;
243	pinctrl-1 = <&spi3_sleep>;
244	pinctrl-names = "default", "sleep";
245	nrf_radio_fem_spi: nrf21540_fem_spi@0 {
246		compatible = "nordic,nrf21540-fem-spi";
247		status = "okay";
248		reg = <0>;
249		spi-max-frequency = <8000000>;
250	};
251};
252
253&radio {
254	fem = <&nrf_radio_fem>;
255};
256
257&ieee802154 {
258	status = "okay";
259};
260
261&flash0 {
262
263	partitions {
264		compatible = "fixed-partitions";
265		#address-cells = <1>;
266		#size-cells = <1>;
267
268		boot_partition: partition@0 {
269			label = "mcuboot";
270			reg = <0x00000000 0x0000C000>;
271		};
272		slot0_partition: partition@c000 {
273			label = "image-0";
274			reg = <0x0000C000 0x00076000>;
275		};
276		slot1_partition: partition@82000 {
277			label = "image-1";
278			reg = <0x00082000 0x00076000>;
279		};
280
281		/*
282		 * The flash starting at 0x000f8000 and ending at
283		 * 0x000fffff is reserved for use by the application.
284		 */
285
286		/*
287		 * Storage partition will be used by FCB/LittleFS/NVS
288		 * if enabled.
289		 */
290		storage_partition: partition@f8000 {
291			label = "storage";
292			reg = <0x000f8000 0x00008000>;
293		};
294	};
295};
296
297zephyr_udc0: &usbd {
298	compatible = "nordic,nrf-usbd";
299	status = "okay";
300};
301