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