1/*
2 * Copyright (c) 2022 Brian Bradley (brian.bradley.p@gmail.com)
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f401Xc.dtsi>
9#include <st/f4/stm32f401c(b-c)ux-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STM32 Mini F401";
14	compatible = "stm32f401_mini";
15
16	chosen {
17		zephyr,console = &usart1;
18		zephyr,shell-uart = &usart1;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21	};
22
23	leds {
24		compatible = "gpio-leds";
25		user_led: led {
26			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
27			label = "User LED";
28		};
29	};
30
31	gpio_keys {
32		compatible = "gpio-keys";
33		boot1: button {
34			label = "BOOT1";
35			gpios = <&gpiob 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
36			zephyr,code = <INPUT_KEY_0>;
37		};
38	};
39
40	aliases {
41		led0 = &user_led;
42		sw0 = &boot1;
43		volt-sensor0 = &vref;
44		volt-sensor1 = &vbat;
45	};
46};
47
48&flash0 {
49	partitions {
50		compatible = "fixed-partitions";
51		#address-cells = <1>;
52		#size-cells = <1>;
53
54		boot_partition: partition@0 {
55			label = "mcuboot";
56			reg = <0x00000000 DT_SIZE_K(64)>;
57			read-only;
58		};
59		slot0_partition: partition@20000 {
60			label = "image-0";
61			reg = <0x00020000 DT_SIZE_K(128)>;
62		};
63		slot1_partition: partition@40000 {
64			label = "image-1";
65			reg = <0x00040000 DT_SIZE_K(128)>;
66		};
67		scratch_partition: partition@60000 {
68			label = "image-scratch";
69			reg = <0x00060000 DT_SIZE_K(128)>;
70		};
71	};
72};
73
74&timers4 {
75	status = "okay";
76
77	pwm4: pwm {
78		status = "okay";
79		pinctrl-0 = <&tim4_ch1_pb6 &tim4_ch2_pb7>;
80		pinctrl-names = "default";
81	};
82};
83
84&usart1 {
85	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
86	pinctrl-names = "default";
87	status = "okay";
88	current-speed = <115200>;
89};
90
91&i2c1 {
92	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
93	pinctrl-names = "default";
94	status = "okay";
95	clock-frequency = <I2C_BITRATE_FAST>;
96};
97
98&spi1 {
99	pinctrl-0 = <&spi1_sck_pa5 &spi1_nss_pa4
100		     &spi1_miso_pa6 &spi1_mosi_pa7>;
101	pinctrl-names = "default";
102	status = "okay";
103};
104
105&rtc {
106	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
107		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
108	status = "okay";
109};
110
111zephyr_udc0: &usbotg_fs {
112	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
113	pinctrl-names = "default";
114	status = "okay";
115};
116
117&adc1 {
118	pinctrl-0 = <&adc1_in1_pa1>;
119	pinctrl-names = "default";
120	st,adc-clock-source = "SYNC";
121	st,adc-prescaler = <2>;
122	status = "okay";
123};
124
125&clk_lsi {
126	status = "okay";
127};
128
129&clk_hse {
130	clock-frequency = <DT_FREQ_M(25)>;
131	status = "okay";
132};
133
134&pll {
135	div-m = <25>;
136	mul-n = <336>;
137	div-p = <4>;
138	div-q = <7>;
139	clocks = <&clk_hse>;
140	status = "okay";
141};
142
143&rcc {
144	clocks = <&pll>;
145	clock-frequency = <DT_FREQ_M(84)>;
146	ahb-prescaler = <1>;
147	apb1-prescaler = <2>;
148	apb2-prescaler = <1>;
149};
150
151&vref {
152	status = "okay";
153};
154
155&vbat {
156	status = "okay";
157};
158