1/*
2 * Copyright (c) 2021 Blue Clover Devices
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/h7/stm32h753Xi.dtsi>
9#include <st/h7/stm32h753zitx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32H743ZI-NUCLEO board";
15	compatible = "st,stm32h753zi-nucleo";
16
17	chosen {
18		zephyr,console = &usart3;
19		zephyr,shell-uart = &usart3;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,dtcm = &dtcm;
23		zephyr,code-partition = &slot0_partition;
24		zephyr,canbus = &fdcan1;
25	};
26
27	leds: leds {
28		compatible = "gpio-leds";
29		green_led: led_0 {
30			gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
31			label = "User LD1";
32		};
33		yellow_led: led_1 {
34			gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
35			label = "User LD2";
36		};
37	};
38
39	pwmleds {
40		compatible = "pwm-leds";
41
42		red_pwm_led: red_pwm_led {
43			pwms = <&pwm12 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
44		};
45	};
46
47	gpio_keys {
48		compatible = "gpio-keys";
49		user_button: button_0 {
50			label = "User";
51			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
52			zephyr,code = <INPUT_KEY_0>;
53		};
54	};
55
56	aliases {
57		led0 = &green_led;
58		led1 = &yellow_led;
59		pwm-led0 = &red_pwm_led;
60		sw0 = &user_button;
61		volt-sensor1 = &vbat;
62	};
63};
64
65&clk_lsi {
66	status = "okay";
67};
68
69&clk_hsi48 {
70	status = "okay";
71};
72
73&clk_hse {
74	hse-bypass;
75	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
76	status = "okay";
77};
78
79&pll {
80	div-m = <2>;
81	mul-n = <240>;
82	div-p = <2>;
83	div-q = <2>;
84	div-r = <2>;
85	clocks = <&clk_hse>;
86	status = "okay";
87};
88
89&pll2 {
90	div-m = <4>;
91	mul-n = <120>;
92	div-p = <2>;
93	div-q = <3>; /* gives 80MHz to the FDCAN */
94	div-r = <2>;
95	clocks = <&clk_hse>;
96	status = "okay";
97};
98
99&rcc {
100	clocks = <&pll>;
101	clock-frequency = <DT_FREQ_M(480)>;
102	d1cpre = <1>;
103	hpre = <2>;
104	d1ppre = <2>;
105	d2ppre1 = <2>;
106	d2ppre2 = <2>;
107	d3ppre = <2>;
108};
109
110&usart3 {
111	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
112	pinctrl-names = "default";
113	current-speed = <115200>;
114	status = "okay";
115};
116
117zephyr_udc0: &usbotg_fs {
118	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
119	pinctrl-names = "default";
120	status = "okay";
121};
122
123&rtc {
124	clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00010000>,
125		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
126	status = "okay";
127};
128
129&i2c1 {
130	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
131	pinctrl-names = "default";
132	status = "okay";
133	clock-frequency = <I2C_BITRATE_FAST>;
134};
135
136&timers12 {
137	st,prescaler = <10000>;
138	status = "okay";
139
140	pwm12: pwm {
141		status = "okay";
142		pinctrl-0 = <&tim12_ch1_pb14>;
143		pinctrl-names = "default";
144	};
145};
146
147&adc1 {
148	pinctrl-0 = <&adc1_inp15_pa3>;
149	pinctrl-names = "default";
150	st,adc-clock-source = <SYNC>;
151	st,adc-prescaler = <4>;
152	status = "okay";
153};
154
155&rng {
156	status = "okay";
157};
158
159&fdcan1 {
160	clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>,
161		 <&rcc STM32_SRC_PLL2_Q FDCAN_SEL(2)>;
162	pinctrl-0 = <&fdcan1_rx_pd0 &fdcan1_tx_pd1>;
163	pinctrl-names = "default";
164	status = "okay";
165};
166
167/*
168 * WARNING:
169 * Possible pin conflicts:
170 *          The pins PA2 and PB13 may conflict on selection of ETH_STM32_HAL,
171 *          since they are used in ST Zio or ST morpho connectors.
172 *          To avoid conflicting states the jumpers JP6 and JP7
173 *          must be in ON state.
174 */
175&mac {
176	status = "okay";
177	pinctrl-0 = <&eth_rxd0_pc4
178		     &eth_rxd1_pc5
179		     &eth_ref_clk_pa1
180		     &eth_crs_dv_pa7
181		     &eth_tx_en_pg11
182		     &eth_txd0_pg13
183		     &eth_txd1_pb13>;
184	pinctrl-names = "default";
185};
186
187&mdio {
188	status = "okay";
189	pinctrl-0 = <&eth_mdio_pa2 &eth_mdc_pc1>;
190	pinctrl-names = "default";
191
192	ethernet-phy@0 {
193		compatible = "ethernet-phy";
194		reg = <0x00>;
195		status = "okay";
196	};
197};
198
199&spi1 {
200	status = "okay";
201	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pb5>;
202	pinctrl-names = "default";
203	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
204};
205
206&flash0 {
207	partitions {
208		compatible = "fixed-partitions";
209		#address-cells = <1>;
210		#size-cells = <1>;
211
212		/* 128KB for bootloader */
213		boot_partition: partition@0 {
214			label = "mcuboot";
215			reg = <0x00000000 DT_SIZE_K(128)>;
216			read-only;
217		};
218
219		/* storage: 128KB for settings */
220		storage_partition: partition@20000 {
221			label = "storage";
222			reg = <0x00020000 DT_SIZE_K(128)>;
223		};
224
225		/* application image slot: 256KB */
226		slot0_partition: partition@40000 {
227			label = "image-0";
228			reg = <0x00040000 DT_SIZE_K(256)>;
229		};
230
231		/* backup slot: 256KB */
232		slot1_partition: partition@80000 {
233			label = "image-1";
234			reg = <0x00080000 DT_SIZE_K(256)>;
235		};
236
237		/* swap slot: 128KB */
238		scratch_partition: partition@c0000 {
239			label = "image-scratch";
240			reg = <0x000c0000 DT_SIZE_K(128)>;
241		};
242
243	};
244};
245