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