1/*
2 * Copyright (c) 2021 Guillaume Paquet <guillaume.paquet@smile.fr>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <nordic/nrf52840_qiaa.dtsi>
9#include <zephyr/dt-bindings/lora/sx126x.h>
10#include "rak4631_nrf52840-pinctrl.dtsi"
11
12/ {
13	model = "RAKWireless RAK4631 WisBlock LPWAN Module with a Nordic NRF52840 SoC";
14	compatible = "nordic,rak4631_nrf52840";
15
16	chosen {
17		zephyr,console = &uart1;
18		zephyr,shell-uart = &uart1;
19		zephyr,uart-mcumgr = &uart1;
20		zephyr,bt-mon-uart = &uart1;
21		zephyr,bt-c2h-uart = &uart1;
22		zephyr,sram = &sram0;
23		zephyr,flash = &flash0;
24		zephyr,code-partition = &slot0_partition;
25	};
26
27	leds {
28		compatible = "gpio-leds";
29		blue_led: led_2 {
30			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
31			label = "Blue LED";
32		};
33		green_led: led_1 {
34			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
35			label = "Green LED";
36		};
37	};
38
39	/* Declaration of aliases */
40	aliases {
41		led0 = &blue_led;
42		lora0 = &lora;
43		watchdog0 = &wdt0;
44	};
45};
46
47&adc {
48	status = "okay";
49};
50
51&uicr {
52	gpio-as-nreset;
53};
54
55&gpiote {
56	status = "okay";
57};
58
59&gpio0 {
60	status = "okay";
61};
62
63&gpio1 {
64	status = "okay";
65};
66
67&uart0 {
68	compatible = "nordic,nrf-uart";
69	status = "okay";
70	current-speed = <115200>;
71	pinctrl-0 = <&uart0_default>;
72	pinctrl-1 = <&uart0_sleep>;
73	pinctrl-names = "default", "sleep";
74};
75
76&uart1 {
77	compatible = "nordic,nrf-uarte";
78	current-speed = <115200>;
79	status = "okay";
80	pinctrl-0 = <&uart1_default>;
81	pinctrl-1 = <&uart1_sleep>;
82	pinctrl-names = "default", "sleep";
83};
84
85&i2c0 {
86	compatible = "nordic,nrf-twi";
87	status = "okay";
88	pinctrl-0 = <&i2c0_default>;
89	pinctrl-1 = <&i2c0_sleep>;
90	pinctrl-names = "default", "sleep";
91};
92
93&i2c1 {
94	compatible = "nordic,nrf-twi";
95	/* Cannot be used together with spi1. */
96	/* status = "okay"; */
97	pinctrl-0 = <&i2c1_default>;
98	pinctrl-1 = <&i2c1_sleep>;
99	pinctrl-names = "default", "sleep";
100};
101
102&spi1 {
103	compatible = "nordic,nrf-spi";
104	status = "okay";
105	cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
106
107	pinctrl-0 = <&spi1_default>;
108	pinctrl-1 = <&spi1_sleep>;
109	pinctrl-names = "default", "sleep";
110	lora: lora@0 {
111		compatible = "semtech,sx1262";
112		reg = <0>;
113		reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
114		busy-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
115		tx-enable-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
116		rx-enable-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
117		dio1-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
118		dio2-tx-enable;
119		dio3-tcxo-voltage = <SX126X_DIO3_TCXO_3V3>;
120		tcxo-power-startup-delay-ms = <5>;
121		spi-max-frequency = <1000000>;
122	};
123};
124
125&qspi {
126	status = "okay";
127	pinctrl-0 = <&qspi_default>;
128	pinctrl-1 = <&qspi_sleep>;
129	pinctrl-names = "default", "sleep";
130};
131
132&flash0 {
133
134	partitions {
135		compatible = "fixed-partitions";
136		#address-cells = <1>;
137		#size-cells = <1>;
138
139		boot_partition: partition@0 {
140			label = "mcuboot";
141			reg = <0x00000000 0x0000C000>;
142		};
143		slot0_partition: partition@c000 {
144			label = "image-0";
145			reg = <0x0000C000 0x00067000>;
146		};
147		slot1_partition: partition@73000 {
148			label = "image-1";
149			reg = <0x00073000 0x00067000>;
150		};
151		scratch_partition: partition@da000 {
152			label = "image-scratch";
153			reg = <0x000da000 0x0001e000>;
154		};
155
156		/*
157		 * The flash starting at 0x000f8000 and ending at
158		 * 0x000fffff is reserved for use by the application.
159		 */
160
161		/*
162		 * Storage partition will be used by FCB/LittleFS/NVS
163		 * if enabled.
164		 */
165		storage_partition: partition@f8000 {
166			label = "storage";
167			reg = <0x000f8000 0x00008000>;
168		};
169	};
170};
171
172zephyr_udc0: &usbd {
173	compatible = "nordic,nrf-usbd";
174	status = "okay";
175};
176