1/*
2 * Copyright (c) 2024 Jerónimo Agulló <jeronimoagullo97@gmail.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <nordic/nrf52840_qiaa.dtsi>
9#include "micromod_nrf52840-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "Sparkfun Micrmod nRF52840 board";
14	compatible = "sparkfun,micromod-nrf52840";
15
16	chosen {
17		zephyr,console = &uart0;
18		zephyr,sram = &sram0;
19		zephyr,flash = &flash0;
20		zephyr,code-partition = &slot0_partition;
21		zephyr,ieee802154 = &ieee802154;
22	};
23
24	/* These aliases are provided for compatibility with samples */
25	aliases {
26		led0 = &led0;
27		watchdog0 = &wdt0;
28	};
29
30	leds {
31		compatible = "gpio-leds";
32		led0: led_0 {
33			gpios = <&gpio0 13 0>;
34			label = "Blue LED";
35		};
36	};
37
38	micromod_header: connector {
39		compatible = "sparkfun,micromod-gpio";
40		#gpio-cells = <2>;
41		gpio-map-mask = <0xffffffff 0xffffffc0>;
42		gpio-map-pass-thru = <0 0x3f>;
43		gpio-map = <0 0 &gpio0 4 0>,	/* A0 */
44			   <1 0 &gpio0 5 0>,	/* A1 */
45			   <2 0 &gpio0 27 0>,	/* D0 */
46			   <3 0 &gpio1 8 0>,	/* D1/CAM_TRIG */
47			   <4 0 &gpio0 15 0>,	/* I2C_INT# */
48			   <5 0 &gpio0 29 0>,	/* G0/BUS0 */
49			   <6 0 &gpio0 3 0>,	/* G1/BUS1 */
50			   <7 0 &gpio1 13 0>,	/* G2/BUS2 */
51			   <8 0 &gpio1 12 0>,	/* G3/BUS3 */
52			   <9 0 &gpio1 11 0>,	/* G4/BUS4 */
53			   <10 0 &gpio0 17 0>,	/* G5/BUS5 */
54			   <11 0 &gpio1 6 0>,	/* G6/BUS6 */
55			   <12 0 &gpio1 4 0>,	/* G7/BUS7 */
56			   <13 0 &gpio1 14 0>,	/* G8 */
57			   <14 0 &gpio0 9 0>,	/* G9/ADC_D-/CAM_HSYNC */
58			   <15 0 &gpio0 10 0>,	/* G10/ADC_D+/CAM_VSYNC */
59			   //<16 NO CONNECTED	/* G11/SWO */
60			   <17 0 &gpio0 20 0>;	/* SPI_CS */
61	};
62};
63
64&adc {
65	status = "okay";
66};
67
68&gpiote {
69	status = "okay";
70};
71
72&gpio0 {
73	status = "okay";
74};
75
76&gpio1 {
77	status = "okay";
78};
79
80&uicr {
81	nfct-pins-as-gpios;
82	gpio-as-nreset;
83};
84
85&uart0 {
86	compatible = "nordic,nrf-uarte";
87	current-speed = <115200>;
88	status = "okay";
89	pinctrl-0 = <&uart0_default>;
90	pinctrl-1 = <&uart0_sleep>;
91	pinctrl-names = "default", "sleep";
92};
93
94&uart1 {
95	compatible = "nordic,nrf-uarte";
96	current-speed = <115200>;
97	status = "okay";
98	pinctrl-0 = <&uart1_default>;
99	pinctrl-1 = <&uart1_sleep>;
100	pinctrl-names = "default", "sleep";
101};
102
103&i2c0 {
104	compatible = "nordic,nrf-twi";
105	status = "okay";
106	pinctrl-0 = <&i2c0_default>;
107	pinctrl-1 = <&i2c0_sleep>;
108	pinctrl-names = "default", "sleep";
109};
110
111&i2c1 {
112	compatible = "nordic,nrf-twi";
113	status = "okay";
114	pinctrl-0 = <&i2c1_default>;
115	pinctrl-1 = <&i2c1_sleep>;
116	pinctrl-names = "default", "sleep";
117};
118
119&spi2 {
120	compatible = "nordic,nrf-spi";
121	status = "okay";
122	cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
123	pinctrl-0 = <&spi0_default>;
124	pinctrl-1 = <&spi0_sleep>;
125	pinctrl-names = "default", "sleep";
126};
127
128&qspi {
129	status = "okay";
130	pinctrl-0 = <&qspi_default>;
131	pinctrl-1 = <&qspi_sleep>;
132	pinctrl-names = "default", "sleep";
133	w25q128jv: w25q128jv@0 {
134		status="okay";
135		compatible = "nordic,qspi-nor";
136		reg = <0>;
137		writeoc = "pp4io";
138		readoc = "read4io";
139		sck-frequency = <DT_FREQ_M(32)>;
140		jedec-id = [ef 70 18];
141		size = <DT_SIZE_M(128)>;
142		has-dpd;
143		t-enter-dpd = <3000>;
144		t-exit-dpd = <3000>;
145	};
146};
147
148&ieee802154 {
149	status = "okay";
150};
151
152&flash0 {
153
154	partitions {
155		compatible = "fixed-partitions";
156		#address-cells = <1>;
157		#size-cells = <1>;
158
159		boot_partition: partition@0 {
160			label = "mcuboot";
161			reg = <0x00000000 0x00010000>;
162		};
163		slot0_partition: partition@10000 {
164			label = "image-0";
165			reg = <0x00010000 0x00076000>;
166		};
167
168		slot1_partition: partition@86000 {
169			label = "image-1";
170			reg = <0x00086000 0x00074000>;
171		};
172
173		/*
174		 * The flash starting at 0x000f8000 and ending at
175		 * 0x000fffff is reserved for use by the application.
176		 */
177
178		/*
179		 * Storage partition will be used by FCB/LittleFS/NVS
180		 * if enabled.
181		 */
182
183		storage_partition: partition@fA000 {
184			label = "storage";
185			reg = <0x000fA000 0x00006000>;
186		};
187	};
188};
189
190zephyr_udc0: &usbd {
191	compatible = "nordic,nrf-usbd";
192	status = "okay";
193};
194
195// Sparkfun Micromod compatible pins
196micromod_1_uart: &uart0 {};
197micromod_2_uart: &uart1 {};
198micromod_0_i2c: &i2c0 {};
199micromod_1_i2c: &i2c1 {};
200micromod_0_spi: &spi2 {};
201