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