1/*
2 * Copyright (c) 2017 Fenix Engineering Solutions
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f411Xe.dtsi>
9#include <st/f4/stm32f411v(c-e)tx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics STM32F411E-DISCO board";
14	compatible = "st,stm32f411e-disco";
15
16	chosen {
17		zephyr,console = &usart2;
18		zephyr,shell-uart = &usart2;
19		zephyr,uart-mcumgr = &usart2;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,code-partition = &slot0_partition;
23	};
24
25	leds {
26		compatible = "gpio-leds";
27		orange_led_3: led_3 {
28			gpios = <&gpiod 13 GPIO_ACTIVE_HIGH>;
29			label = "User LD3";
30		};
31		green_led_4: led_4 {
32			gpios = <&gpiod 12 GPIO_ACTIVE_HIGH>;
33			label = "User LD4";
34		};
35		red_led_5: led_5 {
36			gpios = <&gpiod 14 GPIO_ACTIVE_HIGH>;
37			label = "User LD5";
38		};
39		blue_led_6: led_6 {
40			gpios = <&gpiod 15 GPIO_ACTIVE_HIGH>;
41			label = "User LD6";
42		};
43	};
44
45	pwmleds {
46		compatible = "pwm-leds";
47		green_pwm_led: green_pwm_led {
48			pwms = <&pwm4 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
49		};
50		orange_pwm_led: orange_pwm_led {
51			pwms = <&pwm4 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
52		};
53		red_pwm_led: red_pwm_led {
54			pwms = <&pwm4 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
55		};
56		blue_pwm_led: blue_pwm_led {
57			pwms = <&pwm4 4 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
58		};
59	};
60
61	gpio_keys {
62		compatible = "gpio-keys";
63		user_button: button {
64			label = "User";
65			gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>;
66			zephyr,code = <INPUT_KEY_0>;
67		};
68	};
69
70	aliases {
71		led0 = &orange_led_3;
72		led1 = &green_led_4;
73		led2 = &red_led_5;
74		led3 = &blue_led_6;
75		sw0 = &user_button;
76		pwm-led0 = &green_pwm_led;
77		pwm-led1 = &orange_pwm_led;
78		pwm-led2 = &red_pwm_led;
79		pwm-led3 = &blue_pwm_led;
80		magn0 = &lsm303agr_magn;
81		accel0 = &lsm303agr_accel;
82		mcuboot-button0 = &user_button;
83		mcuboot-led0 = &orange_led_3;
84		die-temp0 = &die_temp;
85		volt-sensor0 = &vref;
86		volt-sensor1 = &vbat;
87	};
88};
89
90&clk_lsi {
91	status = "okay";
92};
93
94&clk_hse {
95	clock-frequency = <DT_FREQ_M(8)>;
96	status = "okay";
97};
98
99&pll {
100	div-m = <4>;
101	mul-n = <96>;
102	div-p = <2>;
103	div-q = <4>;
104	clocks = <&clk_hse>;
105	status = "okay";
106};
107
108&rcc {
109	clocks = <&pll>;
110	clock-frequency = <DT_FREQ_M(96)>;
111	ahb-prescaler = <1>;
112	apb1-prescaler = <2>;
113	apb2-prescaler = <1>;
114};
115
116&timers4 {
117	st,prescaler = <10000>;
118	status = "okay";
119
120	pwm4: pwm {
121		status = "okay";
122		pinctrl-0 = <&tim4_ch1_pd12
123			     &tim4_ch2_pd13
124			     &tim4_ch3_pd14
125			     &tim4_ch4_pd15>;
126		pinctrl-names = "default";
127	};
128};
129
130&i2c1 {
131	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb9>;
132	pinctrl-names = "default";
133	status = "okay";
134	clock-frequency = <I2C_BITRATE_FAST>;
135
136	lsm303agr_magn: lsm303agr-magn@1e {
137		compatible = "st,lis2mdl", "st,lsm303agr-magn";
138		status = "okay";
139		reg = <0x1e>;
140		irq-gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
141	};
142
143	lsm303agr_accel: lsm303agr-accel@19 {
144		compatible = "st,lis2dh", "st,lsm303agr-accel";
145		status = "okay";
146		reg = <0x19>;
147		irq-gpios = <&gpioe 4 GPIO_ACTIVE_HIGH>,
148			  <&gpioe 5 GPIO_ACTIVE_HIGH>;
149	};
150};
151
152&usart2 {
153	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
154	pinctrl-names = "default";
155	current-speed = <115200>;
156	status = "okay";
157};
158
159&rtc {
160	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
161		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
162	status = "okay";
163};
164
165zephyr_udc0: &usbotg_fs {
166	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
167	pinctrl-names = "default";
168	status = "okay";
169};
170
171&flash0 {
172	partitions {
173		compatible = "fixed-partitions";
174		#address-cells = <1>;
175		#size-cells = <1>;
176
177		boot_partition: partition@0 {
178			label = "mcuboot";
179			reg = <0x00000000 DT_SIZE_K(64)>;
180			read-only;
181		};
182
183		slot0_partition: partition@20000 {
184			label = "image-0";
185			reg = <0x00020000 DT_SIZE_K(128)>;
186		};
187
188		slot1_partition: partition@40000 {
189			label = "image-1";
190			reg = <0x00040000 DT_SIZE_K(128)>;
191		};
192
193		scratch_partition: partition@60000 {
194			label = "image-scratch";
195			reg = <0x00060000 DT_SIZE_K(128)>;
196		};
197	};
198};
199
200&adc1 {
201	st,adc-prescaler = <2>;
202	status = "okay";
203};
204
205&die_temp {
206	status = "okay";
207};
208
209&vref {
210	status = "okay";
211};
212
213&vbat {
214	status = "okay";
215};
216