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
30		green_led_2: led_2 {
31			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
32			label = "User LD2";
33		};
34	};
35
36	pwmleds {
37		compatible = "pwm-leds";
38
39		green_pwm_led: green_pwm_led {
40			pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
41		};
42	};
43
44	gpio_keys {
45		compatible = "gpio-keys";
46		user_button: button {
47			label = "User";
48			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
49			zephyr,code = <INPUT_KEY_0>;
50		};
51	};
52
53	aliases {
54		led0 = &green_led_2;
55		sw0 = &user_button;
56		pwm-led0 = &green_pwm_led;
57		watchdog0 = &wwdg;
58		die-temp0 = &die_temp;
59		volt-sensor0 = &vref;
60		volt-sensor1 = &vbat;
61	};
62};
63
64&clk_lsi {
65	status = "okay";
66};
67
68&clk_hse {
69	hse-bypass;
70	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
71	status = "okay";
72};
73
74&pll {
75	div-m = <8>;
76	mul-n = <336>;
77	div-p = <4>;
78	div-q = <7>;
79	clocks = <&clk_hse>;
80	status = "okay";
81};
82
83&rcc {
84	clocks = <&pll>;
85	clock-frequency = <DT_FREQ_M(84)>;
86	ahb-prescaler = <1>;
87	apb1-prescaler = <2>;
88	apb2-prescaler = <1>;
89};
90
91&usart1 {
92	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
93	pinctrl-names = "default";
94	current-speed = <115200>;
95	status = "okay";
96};
97
98&usart2 {
99	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
100	pinctrl-names = "default";
101	current-speed = <115200>;
102	status = "okay";
103};
104
105&i2c1 {
106	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
107	pinctrl-names = "default";
108	status = "okay";
109	clock-frequency = <I2C_BITRATE_FAST>;
110};
111
112&i2c3 {
113	pinctrl-0 = <&i2c3_scl_pa8 &i2c3_sda_pc9>;
114	pinctrl-names = "default";
115	status = "okay";
116	clock-frequency = <I2C_BITRATE_FAST>;
117};
118
119&spi1 {
120	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
121	pinctrl-names = "default";
122	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
123	status = "okay";
124};
125
126&spi2 {
127	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
128		     &spi2_miso_pb14 &spi2_mosi_pb15>;
129	pinctrl-names = "default";
130	status = "okay";
131};
132
133&flash0 {
134	partitions {
135		compatible = "fixed-partitions";
136		#address-cells = <1>;
137		#size-cells = <1>;
138
139		boot_partition: partition@0 {
140			label = "mcuboot";
141			reg = <0x00000000 DT_SIZE_K(64)>;
142			read-only;
143		};
144
145		/*
146		 * The flash starting at offset 0x10000 and ending at
147		 * offset 0x1ffff is reserved for use by the application.
148		 */
149
150		slot0_partition: partition@20000 {
151			label = "image-0";
152			reg = <0x00020000 DT_SIZE_K(128)>;
153		};
154
155		slot1_partition: partition@40000 {
156			label = "image-1";
157			reg = <0x00040000 DT_SIZE_K(128)>;
158		};
159
160		scratch_partition: partition@60000 {
161			label = "image-scratch";
162			reg = <0x00060000 DT_SIZE_K(128)>;
163		};
164	};
165};
166
167&timers2 {
168	status = "okay";
169
170	pwm2: pwm {
171		status = "okay";
172		pinctrl-0 = <&tim2_ch1_pa5>;
173		pinctrl-names = "default";
174	};
175};
176
177&rtc {
178	clocks = <&rcc STM32_CLOCK(APB1, 28)>,
179		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
180	status = "okay";
181};
182
183&adc1 {
184	pinctrl-0 = <&adc1_in0_pa0>;
185	pinctrl-names = "default";
186	st,adc-clock-source = "SYNC";
187	st,adc-prescaler = <2>;
188	status = "okay";
189};
190
191&die_temp {
192	status = "okay";
193};
194
195&wwdg {
196	status = "okay";
197};
198
199&vref {
200	status = "okay";
201};
202
203&vbat {
204	status = "okay";
205};
206