1/*
2 * Copyright (c) 2017 Linaro Limited
3 * Copyright (c) 2019 Centaur Analytics, Inc
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <st/f4/stm32f401Xe.dtsi>
10#include <st/f4/stm32f401r(d-e)tx-pinctrl.dtsi>
11#include "arduino_r3_connector.dtsi"
12#include "st_morpho_connector.dtsi"
13#include <zephyr/dt-bindings/input/input-event-codes.h>
14
15/ {
16	model = "STMicroelectronics STM32F401RE-NUCLEO board";
17	compatible = "st,stm32f401re-nucleo";
18
19	chosen {
20		zephyr,console = &usart2;
21		zephyr,shell-uart = &usart2;
22		zephyr,sram = &sram0;
23		zephyr,flash = &flash0;
24		zephyr,code-partition = &slot0_partition;
25	};
26
27	leds: leds {
28		compatible = "gpio-leds";
29		green_led_2: led_2 {
30			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
31			label = "User LD2";
32		};
33	};
34
35	pwmleds {
36		compatible = "pwm-leds";
37		green_pwm_led: green_pwm_led {
38			pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
39		};
40	};
41
42	gpio_keys {
43		compatible = "gpio-keys";
44		user_button: button {
45			label = "User";
46			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
47			zephyr,code = <INPUT_KEY_0>;
48		};
49	};
50
51	aliases {
52		led0 = &green_led_2;
53		sw0 = &user_button;
54		pwm-led0 = &green_pwm_led;
55		watchdog0 = &wwdg;
56		die-temp0 = &die_temp;
57		volt-sensor0 = &vref;
58		volt-sensor1 = &vbat;
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 = <336>;
75	div-p = <4>;
76	div-q = <7>;
77	clocks = <&clk_hse>;
78	status = "okay";
79};
80
81&rcc {
82	clocks = <&pll>;
83	clock-frequency = <DT_FREQ_M(84)>;
84	ahb-prescaler = <1>;
85	apb1-prescaler = <2>;
86	apb2-prescaler = <1>;
87};
88
89&usart1 {
90	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
91	pinctrl-names = "default";
92	current-speed = <115200>;
93	status = "okay";
94};
95
96&usart2 {
97	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
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&i2c3 {
111	pinctrl-0 = <&i2c3_scl_pa8 &i2c3_sda_pc9>;
112	pinctrl-names = "default";
113	status = "okay";
114	clock-frequency = <I2C_BITRATE_FAST>;
115};
116
117&spi1 {
118	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
119	pinctrl-names = "default";
120	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
121	status = "okay";
122};
123
124&spi2 {
125	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
126		     &spi2_miso_pb14 &spi2_mosi_pb15>;
127	pinctrl-names = "default";
128	status = "okay";
129};
130
131&flash0 {
132
133	partitions {
134		compatible = "fixed-partitions";
135		#address-cells = <1>;
136		#size-cells = <1>;
137
138		boot_partition: partition@0 {
139			label = "mcuboot";
140			reg = <0x00000000 DT_SIZE_K(64)>;
141			read-only;
142		};
143
144		/*
145		 * The flash starting at offset 0x10000 and ending at
146		 * offset 0x1ffff is reserved for use by the application.
147		 */
148
149		slot0_partition: partition@20000 {
150			label = "image-0";
151			reg = <0x00020000 DT_SIZE_K(128)>;
152		};
153		slot1_partition: partition@40000 {
154			label = "image-1";
155			reg = <0x00040000 DT_SIZE_K(128)>;
156		};
157		scratch_partition: partition@60000 {
158			label = "image-scratch";
159			reg = <0x00060000 DT_SIZE_K(128)>;
160		};
161	};
162};
163
164&timers2 {
165	status = "okay";
166
167	pwm2: pwm {
168		status = "okay";
169		pinctrl-0 = <&tim2_ch1_pa5>;
170		pinctrl-names = "default";
171	};
172};
173
174&rtc {
175	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
176		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
177	status = "okay";
178};
179
180&adc1 {
181	pinctrl-0 = <&adc1_in0_pa0>;
182	pinctrl-names = "default";
183	st,adc-clock-source = <SYNC>;
184	st,adc-prescaler = <2>;
185	status = "okay";
186};
187
188&die_temp {
189	status = "okay";
190};
191
192&wwdg {
193	status = "okay";
194};
195
196&vref {
197	status = "okay";
198};
199
200&vbat {
201	status = "okay";
202};
203