1/*
2 * Copyright (c) 2020 u-blox AG
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <nordic/nrf52833_qiaa.dtsi>
9#include "ubx_evkninab4_nrf52833-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "u-blox EVK-NINA-B4 NRF52833";
14	compatible = "u-blox,ubx_evkninab4_nrf52833";
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			/* NINA-B1 GPIO_1 */
32			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
33			label = "Red LED";
34		};
35		led1: led_1 {
36			/* NINA-B4 GPIO_7 */
37			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
38			label = "Green LED";
39		};
40		led2: led_2 {
41			/*NINA-B1 GPIO_8 */
42			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
43			label = "Blue LED";
44		};
45	};
46
47	pwmleds {
48		compatible = "pwm-leds";
49		red_pwm_led: red_pwm_led {
50			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
51		};
52		green_pwm_led: green_pwm_led {
53			pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
54		};
55		blue_pwm_led: blue_pwm_led {
56			pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
57		};
58	};
59
60	buttons {
61		compatible = "gpio-keys";
62		button0: button_0 {
63			/* EVK-NINA-B4 SW1 button */
64			gpios = <&gpio1 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
65			label = "Push button switch 0";
66			zephyr,code = <INPUT_KEY_0>;
67		};
68		button1: button_1 {
69			/* EVK-NINA-B4 SW2 button */
70			gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
71			label = "Push button switch 1";
72			zephyr,code = <INPUT_KEY_1>;
73		};
74	};
75
76	arduino_header: connector {
77		compatible = "arduino-header-r3";
78		#gpio-cells = <2>;
79		gpio-map-mask = <0xffffffff 0xffffffc0>;
80		gpio-map-pass-thru = <0 0x3f>;
81		gpio-map = <0 0 &gpio0 4 0>,	/* A0 */
82			   <1 0 &gpio0 30 0>,	/* A1 */
83			   <2 0 &gpio0 5 0>,	/* A2 */
84			   <3 0 &gpio0 2 0>,	/* A3 */
85			   <4 0 &gpio0 28 0>,	/* A4 */
86			   <5 0 &gpio0 3 0>,	/* A5 */
87			   <6 0 &gpio0 29 0>,	/* D0 */
88			   <7 0 &gpio1 5 0>,	/* D1 */
89			   <8 0 &gpio0 23 0>,	/* D2 */
90			   <9 0 &gpio0 31 0>,	/* D3 */
91			   <10 0 &gpio0 13 0>,	/* D4 */
92			   <11 0 &gpio0 11 0>,	/* D5 */
93			   <12 0 &gpio0 9 0>,	/* D6 */ /* NFC use by default */
94			   <13 0 &gpio0 10 0>,	/* D7 */ /* NFC use by default */
95			   <14 0 &gpio1 9 0>,	/* D8 */
96			   <15 0 &gpio0 12 0>,	/* D9 */
97			   <16 0 &gpio0 0 0>,	/* D10 */ /* Disconnected, see EVK User Guide */
98			   <17 0 &gpio0 1 0>,	/* D11 */ /* Disconnected, see EVK User Guide */
99			   <18 0 &gpio1 0 0>,	/* D12 */
100			   <19 0 &gpio0 7 0>,	/* D13 */
101			   <20 0 &gpio0 16 0>,	/* D14 */  /* SDA */
102			   <21 0 &gpio0 17 0>;	/* D15 */  /* SCL */
103	};
104
105	arduino_adc: analog-connector {
106		compatible = "arduino,uno-adc";
107		#io-channel-cells = <1>;
108		io-channel-map = <0 &adc 2>,	/* A0 = P0.04 = AIN2 */
109				 <1 &adc 6>,	/* A1 = P0.30 = AIN6 */
110				 <2 &adc 3>,	/* A2 = P0.5 = AIN3 */
111				 <3 &adc 0>,	/* A3 = P0.2 = AIN0 */
112				 <4 &adc 4>,	/* A4 = P0.28 = AIN4 */
113				 <5 &adc 1>;	/* A5 = P0.3 = AIN1 */
114	};
115
116	/* These aliases are provided for compatibility with samples */
117	aliases {
118		led0 = &led0;
119		led1 = &led1;
120		led2 = &led2;
121		pwm-led0 = &red_pwm_led;
122		pwm-led1 = &green_pwm_led;
123		pwm-led2 = &blue_pwm_led;
124		red-pwm-led = &red_pwm_led;
125		green-pwm-led = &green_pwm_led;
126		blue-pwm-led = &blue_pwm_led;
127		sw0 = &button0;
128		sw1 = &button1;
129		watchdog0 = &wdt0;
130	};
131};
132
133&adc {
134	status = "okay";
135};
136
137&uicr {
138	gpio-as-nreset;
139};
140
141&gpiote {
142	status = "okay";
143};
144
145&gpio0 {
146	status = "okay";
147};
148
149&gpio1 {
150	status = "okay";
151};
152
153&uart0 {
154	compatible = "nordic,nrf-uart";
155	status = "okay";
156	current-speed = <115200>;
157	pinctrl-0 = <&uart0_default>;
158	pinctrl-1 = <&uart0_sleep>;
159	pinctrl-names = "default", "sleep";
160};
161
162arduino_i2c: &i2c0 {
163	compatible = "nordic,nrf-twi";
164	status = "okay";
165	pinctrl-0 = <&i2c0_default>;
166	pinctrl-1 = <&i2c0_sleep>;
167	pinctrl-names = "default", "sleep";
168};
169
170&spi0 {
171	compatible = "nordic,nrf-spi";
172	/* Cannot be used together with i2c0. */
173	/* status = "okay"; */
174	pinctrl-0 = <&spi0_default>;
175	pinctrl-1 = <&spi0_sleep>;
176	pinctrl-names = "default", "sleep";
177};
178
179&spi1 {
180	compatible = "nordic,nrf-spi";
181	status = "okay";
182	pinctrl-0 = <&spi1_default>;
183	pinctrl-1 = <&spi1_sleep>;
184	pinctrl-names = "default", "sleep";
185};
186
187arduino_spi: &spi2 {
188	compatible = "nordic,nrf-spim";
189	status = "okay";
190	cs-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; /* D10 */
191	pinctrl-0 = <&spi2_default>;
192	pinctrl-1 = <&spi2_sleep>;
193	pinctrl-names = "default", "sleep";
194};
195
196&pwm0 {
197	status = "okay";
198	pinctrl-0 = <&pwm0_default>;
199	pinctrl-1 = <&pwm0_sleep>;
200	pinctrl-names = "default", "sleep";
201};
202
203&ieee802154 {
204	status = "okay";
205};
206
207&flash0 {
208	partitions {
209		compatible = "fixed-partitions";
210		#address-cells = <1>;
211		#size-cells = <1>;
212
213		boot_partition: partition@0 {
214			label = "mcuboot";
215			reg = <0x00000000 0xC000>;
216		};
217		slot0_partition: partition@c000 {
218			label = "image-0";
219			reg = <0x0000C000 0x32000>;
220		};
221		slot1_partition: partition@3e000 {
222			label = "image-1";
223			reg = <0x0003E000 0x32000>;
224		};
225		scratch_partition: partition@70000 {
226			label = "image-scratch";
227			reg = <0x00070000 0xA000>;
228		};
229		storage_partition: partition@7a000 {
230			label = "storage";
231			reg = <0x0007A000 0x00006000>;
232		};
233	};
234};
235
236zephyr_udc0: &usbd {
237	compatible = "nordic,nrf-usbd";
238	status = "okay";
239};
240