1/*
2 * Copyright (c) 2019 Roland Ma
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f7/stm32f767Xi.dtsi>
9#include <st/f7/stm32f767zitx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/*
14 * WARNING: The pin PA7 will conflict on selection of SPI_1 and ETH_STM32_HAL.
15 *          If you require both peripherals, and you do not need Arduino Uno v3
16 *          compatibility, the pin PB5 (also on ST Zio connector) can be used
17 *          for the SPI_1 MOSI signal.
18 */
19
20/ {
21	model = "STMicroelectronics STM32F767ZI-NUCLEO board";
22	compatible = "st,stm32f767zi-nucleo";
23
24	chosen {
25		zephyr,console = &usart3;
26		zephyr,shell-uart = &usart3;
27		zephyr,sram = &sram0;
28		zephyr,flash = &flash0;
29		zephyr,code-partition = &slot0_partition;
30		zephyr,dtcm = &dtcm;
31		zephyr,canbus = &can1;
32	};
33
34	leds: leds {
35		compatible = "gpio-leds";
36		green_led: led_0 {
37			gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
38			label = "User LD1";
39		};
40		blue_led: led_1 {
41			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
42			label = "User LD2";
43		};
44		red_led: led_2 {
45			gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
46			label = "User LD3";
47		};
48	};
49
50	gpio_keys {
51		compatible = "gpio-keys";
52		user_button: button_0 {
53			label = "User";
54			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
55			zephyr,code = <INPUT_KEY_0>;
56		};
57	};
58
59	aliases {
60		led0 = &green_led;
61		led1 = &blue_led;
62		led2 = &red_led;
63		sw0 = &user_button;
64		watchdog0 = &iwdg;
65		volt-sensor0 = &vref;
66		volt-sensor1 = &vbat;
67	};
68};
69
70&clk_lsi {
71	status = "okay";
72};
73
74&clk_hse {
75	hse-bypass;
76	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
77	status = "okay";
78};
79
80&pll {
81	div-m = <4>;
82	mul-n = <216>;
83	div-p = <2>;
84	div-q = <9>;
85	clocks = <&clk_hse>;
86	status = "okay";
87};
88
89&rcc {
90	clocks = <&pll>;
91	clock-frequency = <DT_FREQ_M(216)>;
92	ahb-prescaler = <1>;
93	apb1-prescaler = <4>;
94	apb2-prescaler = <2>;
95};
96
97&usart2 {
98	pinctrl-0 = <&usart2_tx_pd5
99		     &usart2_rx_pd6
100		     &usart2_rts_pd4
101		     &usart2_cts_pd3>;
102	pinctrl-names = "default";
103	current-speed = <115200>;
104};
105
106&usart3 {
107	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
108	pinctrl-names = "default";
109	current-speed = <115200>;
110	status = "okay";
111};
112
113&usart6 {
114	pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
115	pinctrl-names = "default";
116	current-speed = <115200>;
117	status = "okay";
118};
119
120zephyr_udc0: &usbotg_fs {
121	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
122	pinctrl-names = "default";
123	status = "okay";
124};
125
126&i2c1 {
127	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
128	pinctrl-names = "default";
129	status = "okay";
130	clock-frequency = <I2C_BITRATE_FAST>;
131};
132
133&timers1 {
134	st,prescaler = <10000>;
135	status = "okay";
136
137	pwm1: pwm {
138		status = "okay";
139		pinctrl-0 = <&tim1_ch3_pe13>;
140		pinctrl-names = "default";
141	};
142};
143
144&spi1 {
145	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
146	pinctrl-names = "default";
147	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
148	/*
149	 * WARNING: The pin PA7 will conflict on selection of SPI_1 and
150	 *          ETH_STM32_HAL.
151	 */
152	status = "okay";
153};
154
155&iwdg {
156	status = "okay";
157};
158
159&rtc {
160	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
161		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
162	status = "okay";
163};
164
165&can1 {
166	pinctrl-0 = <&can1_rx_pd0 &can1_tx_pd1>;
167	pinctrl-names = "default";
168	status = "okay";
169};
170
171&adc1 {
172	pinctrl-0 = <&adc1_in0_pa0>;
173	pinctrl-names = "default";
174	st,adc-clock-source = "SYNC";
175	st,adc-prescaler = <2>;
176	status = "okay";
177};
178
179&dac1 {
180	status = "okay";
181	pinctrl-0 = <&dac_out1_pa4>;
182	pinctrl-names = "default";
183};
184
185&rng {
186	status = "okay";
187};
188
189&mac {
190	status = "okay";
191	pinctrl-0 = <&eth_mdc_pc1
192		     &eth_rxd0_pc4
193		     &eth_rxd1_pc5
194		     &eth_ref_clk_pa1
195		     &eth_mdio_pa2
196		     &eth_crs_dv_pa7
197		     &eth_tx_en_pg11
198		     &eth_txd0_pg13
199		     &eth_txd1_pb13>;
200	pinctrl-names = "default";
201};
202
203&flash0 {
204	partitions {
205		compatible = "fixed-partitions";
206		#address-cells = <1>;
207		#size-cells = <1>;
208
209		/*
210		 * The two sectors 0-1 (32+32 kbytes) are reserved for
211		 * the bootloader.
212		 */
213		boot_partition: partition@0 {
214			label = "mcuboot";
215			reg = <0x0 DT_SIZE_K(64)>;
216			read-only;
217		};
218
219		/*
220		 * The flash starting at offset 0x10000 and ending at
221		 * offset 0x1ffff is reserved for use by the application.
222		 * This represents sectors 2-3 (32+32 kbytes)
223		 */
224		storage_partition: partition@10000 {
225			label = "storage";
226			reg = <0x00010000 DT_SIZE_K(64)>;
227		};
228
229		/*
230		 * Sector 4 (128 kbytes) unallocated.
231		 */
232
233		/*
234		 * Allocated 3 (256k x 3) sectors for image-0. Sectors 5-7.
235		 */
236		slot0_partition: partition@40000 {
237			label = "image-0";
238			reg = <0x00040000 DT_SIZE_K(768)>;
239		};
240
241		/*
242		 * Allocated 3 (256k x 3) sectors for image-1. Sectors 8-10.
243		 */
244		slot1_partition: partition@100000 {
245			label = "image-1";
246			reg = <0x00100000 DT_SIZE_K(768)>;
247		};
248
249		/*
250		 * Allocated 1 (256k) sector for image-scratch. Sector 11.
251		 */
252		scratch_partition: partition@1C0000 {
253			label = "image-scratch";
254			reg = <0x001C0000 DT_SIZE_K(256)>;
255		};
256	};
257};
258
259&vref {
260	status = "okay";
261};
262
263&vbat {
264	status = "okay";
265};
266