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&spi1 {
111	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
112	pinctrl-names = "default";
113	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
114	status = "okay";
115};
116
117&spi2 {
118	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
119		     &spi2_miso_pb14 &spi2_mosi_pb15>;
120	pinctrl-names = "default";
121	status = "okay";
122};
123
124&flash0 {
125
126	partitions {
127		compatible = "fixed-partitions";
128		#address-cells = <1>;
129		#size-cells = <1>;
130
131		boot_partition: partition@0 {
132			label = "mcuboot";
133			reg = <0x00000000 DT_SIZE_K(64)>;
134			read-only;
135		};
136
137		/*
138		 * The flash starting at offset 0x10000 and ending at
139		 * offset 0x1ffff is reserved for use by the application.
140		 */
141
142		slot0_partition: partition@20000 {
143			label = "image-0";
144			reg = <0x00020000 DT_SIZE_K(128)>;
145		};
146		slot1_partition: partition@40000 {
147			label = "image-1";
148			reg = <0x00040000 DT_SIZE_K(128)>;
149		};
150		scratch_partition: partition@60000 {
151			label = "image-scratch";
152			reg = <0x00060000 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_pa5>;
163		pinctrl-names = "default";
164	};
165};
166
167&rtc {
168	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
169		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
170	status = "okay";
171};
172
173&adc1 {
174	pinctrl-0 = <&adc1_in0_pa0>;
175	pinctrl-names = "default";
176	st,adc-clock-source = <SYNC>;
177	st,adc-prescaler = <2>;
178	status = "okay";
179};
180
181&die_temp {
182	status = "okay";
183};
184
185&wwdg {
186	status = "okay";
187};
188
189&vref {
190	status = "okay";
191};
192
193&vbat {
194	status = "okay";
195};
196