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