1/*
2 * Copyright (c) 2021 Tom Owen
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f446Xe.dtsi>
9#include <st/f4/stm32f446z(c-e)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32F446ZE-NUCLEO board";
15	compatible = "st,stm32f446ze-nucleo";
16
17	chosen {
18		zephyr,console = &usart3;
19		zephyr,shell-uart = &usart3;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,canbus = &can1;
23	};
24
25	leds: leds {
26		compatible = "gpio-leds";
27		green_led_1: led_1 {
28			gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
29			label = "User LD1";
30		};
31		blue_led_2: led_2 {
32			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
33			label = "User LD2";
34		};
35		red_led_3: led_3 {
36			gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
37			label = "User LD3";
38		};
39	};
40
41	gpio_keys {
42		compatible = "gpio-keys";
43		user_button: button {
44			label = "User";
45			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
46			zephyr,code = <INPUT_KEY_0>;
47		};
48	};
49
50	aliases {
51		led0 = &green_led_1;
52		led1 = &blue_led_2;
53		led2 = &red_led_3;
54		sw0 = &user_button;
55		volt-sensor0 = &vref;
56		volt-sensor1 = &vbat;
57	};
58};
59
60&clk_lsi {
61	status = "okay";
62};
63
64&clk_hse {
65	hse-bypass;
66	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
67	status = "okay";
68};
69
70&pll {
71	div-m = <8>;
72	mul-n = <336>;
73	div-p = <2>;
74	div-q = <7>;
75	clocks = <&clk_hse>;
76	status = "okay";
77};
78
79&rcc {
80	clocks = <&pll>;
81	clock-frequency = <DT_FREQ_M(168)>; /* highest value to get a precise USB clock */
82	ahb-prescaler = <1>;
83	apb1-prescaler = <4>;
84	apb2-prescaler = <2>;
85};
86
87&adc1 {
88	pinctrl-0 = <&adc1_in0_pa0>;
89	pinctrl-names = "default";
90	st,adc-clock-source = <SYNC>;
91	st,adc-prescaler = <2>;
92	status = "okay";
93};
94
95&dac1 {
96	status = "okay";
97	pinctrl-0 = <&dac_out1_pa4>;
98	pinctrl-names = "default";
99};
100
101&usart2 {
102	pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;
103	pinctrl-names = "default";
104	current-speed = <115200>;
105	status = "okay";
106};
107
108&usart3 {
109	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
110	pinctrl-names = "default";
111	current-speed = <115200>;
112	status = "okay";
113};
114
115&usart6 {
116	pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
117	pinctrl-names = "default";
118	current-speed = <115200>;
119	status = "okay";
120};
121
122
123&i2c1 {
124	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
125	pinctrl-names = "default";
126	status = "okay";
127	clock-frequency = <I2C_BITRATE_FAST>;
128};
129
130&i2c2 {
131	pinctrl-0 = <&i2c2_scl_pf1 &i2c2_sda_pf0>;
132	pinctrl-names = "default";
133	status = "okay";
134	clock-frequency = <I2C_BITRATE_FAST>;
135};
136
137
138&spi1 {
139	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
140	pinctrl-names = "default";
141	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
142	status = "okay";
143};
144
145&spi2 {
146	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
147		&spi2_miso_pb14 &spi2_mosi_pb15>;
148	pinctrl-names = "default";
149	status = "okay";
150};
151
152zephyr_udc0: &usbotg_fs {
153	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12
154		&usb_otg_fs_id_pa10>;
155	pinctrl-names = "default";
156	status = "okay";
157};
158
159
160&timers1 {
161	status = "okay";
162
163	pwm1: pwm {
164		status = "okay";
165		pinctrl-0 = <&tim1_ch1_pe9>;
166		pinctrl-names = "default";
167	};
168};
169
170&rtc {
171	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
172		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
173	status = "okay";
174};
175
176&backup_sram {
177	status = "okay";
178};
179
180&can1 {
181	pinctrl-0 = <&can1_rx_pd0 &can1_tx_pd1>;
182	pinctrl-names = "default";
183	status = "okay";
184};
185
186&flash0 {
187
188	partitions {
189		compatible = "fixed-partitions";
190		#address-cells = <1>;
191		#size-cells = <1>;
192
193		boot_partition: partition@0 {
194			label = "mcuboot";
195			reg = <0x00000000 DT_SIZE_K(64)>;
196			read-only;
197		};
198
199		/*
200		 * The flash starting at 0x00010000 and ending at
201		 * 0x0001ffff (sectors 16-31) is reserved for use
202		 * by the application.
203		 */
204		storage_partition: partition@10000 {
205			label = "storage";
206			reg = <0x00010000 DT_SIZE_K(64)>;
207		};
208
209		slot0_partition: partition@20000 {
210			label = "image-0";
211			reg = <0x00020000 DT_SIZE_K(128)>;
212		};
213		slot1_partition: partition@40000 {
214			label = "image-1";
215			reg = <0x00040000 DT_SIZE_K(128)>;
216		};
217		scratch_partition: partition@60000 {
218			label = "image-scratch";
219			reg = <0x00060000 DT_SIZE_K(128)>;
220		};
221	};
222};
223
224&vref {
225	status = "okay";
226};
227
228&vbat {
229	status = "okay";
230};
231