1/*
2 * Copyright (c) 2017 Florian Vaussard, HEIG-VD
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f413Xh.dtsi>
9#include <st/f4/stm32f413z(g-h)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32F413ZH-NUCLEO board";
15	compatible = "st,stm32f413zh-nucleo";
16
17	chosen {
18		zephyr,console = &usart3;
19		zephyr,shell-uart = &usart3;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,code-partition = &slot0_partition;
23	};
24
25	leds: leds {
26		compatible = "gpio-leds";
27
28		green_led_1: led_1 {
29			gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
30			label = "User LD1";
31		};
32
33		blue_led_1: led_2 {
34			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
35			label = "User LD2";
36		};
37
38		red_led_1: led_3 {
39			gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
40			label = "User LD3";
41		};
42	};
43
44	gpio_keys {
45		compatible = "gpio-keys";
46
47		user_button: button {
48			label = "User";
49			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
50			zephyr,code = <INPUT_KEY_0>;
51		};
52	};
53
54	aliases {
55		led0 = &green_led_1;
56		led1 = &blue_led_1;
57		led2 = &red_led_1;
58		sw0 = &user_button;
59	};
60};
61
62&clk_lsi {
63	status = "okay";
64};
65
66&clk_hse {
67	hse-bypass;
68	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
69	status = "okay";
70};
71
72&pll {
73	div-m = <8>;
74	mul-n = <384>;
75	div-p = <4>;
76	div-q = <8>;
77	clocks = <&clk_hse>;
78	status = "okay";
79};
80
81&rcc {
82	clocks = <&pll>;
83	clock-frequency = <DT_FREQ_M(96)>;
84	ahb-prescaler = <1>;
85	apb1-prescaler = <2>;
86	apb2-prescaler = <1>;
87};
88
89&usart3 {
90	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
91	pinctrl-names = "default";
92	current-speed = <115200>;
93	status = "okay";
94};
95
96&usart6 {
97	pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
98	pinctrl-names = "default";
99	current-speed = <115200>;
100	status = "okay";
101};
102
103&i2c1 {
104	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
105	pinctrl-names = "default";
106	status = "okay";
107	clock-frequency = <I2C_BITRATE_FAST>;
108};
109
110&spi1 {
111	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
112	pinctrl-names = "default";
113	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
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&flash0 {
124	partitions {
125		compatible = "fixed-partitions";
126		#address-cells = <1>;
127		#size-cells = <1>;
128
129		boot_partition: partition@0 {
130			label = "mcuboot";
131			reg = <0x00000000 DT_SIZE_K(64)>;
132			read-only;
133		};
134
135		/*
136		 * The flash starting at offset 0x10000 and ending at
137		 * offset 0x1ffff is reserved for use by the application.
138		 */
139
140		slot0_partition: partition@20000 {
141			label = "image-0";
142			reg = <0x00020000 DT_SIZE_K(256)>;
143		};
144
145		slot1_partition: partition@60000 {
146			label = "image-1";
147			reg = <0x00060000 DT_SIZE_K(256)>;
148		};
149
150		scratch_partition: partition@a0000 {
151			label = "image-scratch";
152			reg = <0x000a0000 DT_SIZE_K(128)>;
153		};
154	};
155};
156
157&timers2 {
158	status = "okay";
159
160	pwm2: pwm {
161		status = "okay";
162		pinctrl-0 = <&tim2_ch1_pa0>;
163		pinctrl-names = "default";
164	};
165};
166
167&rtc {
168	clocks = <&rcc STM32_CLOCK(APB1, 28)>,
169		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
170	status = "okay";
171};
172