1/*
2 * Copyright (c) 2020 Kalyan Sriram <coder.kalyan@gmail.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f401Xe.dtsi>
9#include <st/f4/stm32f401c(d-e)ux-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "WeAct Studio Black Pill V3.0 Board";
14	compatible = "weact,blackpill-f401ce";
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		user_button: button {
34			label = "KEY";
35			gpios = <&gpioa 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
36			zephyr,code = <INPUT_KEY_0>;
37		};
38	};
39
40	aliases {
41		led0 = &user_led;
42		sw0 = &user_button;
43		volt-sensor0 = &vref;
44		volt-sensor1 = &vbat;
45	};
46};
47
48&flash0 {
49
50	partitions {
51		compatible = "fixed-partitions";
52		#address-cells = <1>;
53		#size-cells = <1>;
54
55		boot_partition: partition@0 {
56			label = "mcuboot";
57			reg = <0x00000000 DT_SIZE_K(32)>;
58			read-only;
59		};
60
61		/*
62		 * The flash starting at offset 0x00008000 and ending at
63		 * offset 0x0001ffff (sectors 2 through 4) is reserved for
64		 * use by the application.
65		 */
66
67		slot0_partition: partition@20000 {
68			label = "image-0";
69			reg = <0x00020000 DT_SIZE_K(128)>;
70		};
71		slot1_partition: partition@40000 {
72			label = "image-1";
73			reg = <0x00040000 DT_SIZE_K(128)>;
74		};
75		scratch_partition: partition@60000 {
76			label = "image-scratch";
77			reg = <0x00060000 DT_SIZE_K(128)>;
78		};
79	};
80};
81
82&timers4 {
83	status = "okay";
84
85	pwm4: pwm {
86		status = "okay";
87		pinctrl-0 = <&tim4_ch1_pb6 &tim4_ch2_pb7>;
88		pinctrl-names = "default";
89	};
90};
91
92&usart1 {
93	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
94	pinctrl-names = "default";
95	status = "okay";
96	current-speed = <115200>;
97};
98
99&i2c1 {
100	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
101	pinctrl-names = "default";
102	status = "okay";
103	clock-frequency = <I2C_BITRATE_FAST>;
104};
105
106&spi1 {
107	pinctrl-0 = <&spi1_sck_pa5 &spi1_nss_pa4
108		     &spi1_miso_pa6 &spi1_mosi_pa7>;
109	pinctrl-names = "default";
110	status = "okay";
111};
112
113&rtc {
114	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
115		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
116	status = "okay";
117};
118
119zephyr_udc0: &usbotg_fs {
120	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
121	pinctrl-names = "default";
122	status = "okay";
123};
124
125&adc1 {
126	pinctrl-0 = <&adc1_in1_pa1>;
127	pinctrl-names = "default";
128	st,adc-clock-source = <SYNC>;
129	st,adc-prescaler = <2>;
130	status = "okay";
131};
132
133&clk_lsi {
134	status = "okay";
135};
136
137&clk_hse {
138	clock-frequency = <DT_FREQ_M(25)>;
139	status = "okay";
140};
141
142&pll {
143	div-m = <25>;
144	mul-n = <336>;
145	div-p = <4>;
146	div-q = <7>;
147	clocks = <&clk_hse>;
148	status = "okay";
149};
150
151&rcc {
152	clocks = <&pll>;
153	clock-frequency = <DT_FREQ_M(84)>;
154	ahb-prescaler = <1>;
155	apb1-prescaler = <2>;
156	apb2-prescaler = <1>;
157};
158
159&vref {
160	status = "okay";
161};
162
163&vbat {
164	status = "okay";
165};
166