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	};
85};
86
87&clk_lsi {
88	status = "okay";
89};
90
91&clk_hse {
92	clock-frequency = <DT_FREQ_M(8)>;
93	status = "okay";
94};
95
96&pll {
97	div-m = <4>;
98	mul-n = <96>;
99	div-p = <2>;
100	div-q = <4>;
101	clocks = <&clk_hse>;
102	status = "okay";
103};
104
105&rcc {
106	clocks = <&pll>;
107	clock-frequency = <DT_FREQ_M(96)>;
108	ahb-prescaler = <1>;
109	apb1-prescaler = <2>;
110	apb2-prescaler = <1>;
111};
112
113&timers4 {
114	st,prescaler = <10000>;
115	status = "okay";
116
117	pwm4: pwm {
118		status = "okay";
119		pinctrl-0 = <&tim4_ch1_pd12
120			     &tim4_ch2_pd13
121			     &tim4_ch3_pd14
122			     &tim4_ch4_pd15>;
123		pinctrl-names = "default";
124	};
125};
126
127&i2c1 {
128	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb9>;
129	pinctrl-names = "default";
130	status = "okay";
131	clock-frequency = <I2C_BITRATE_FAST>;
132
133	lsm303agr_magn: lsm303agr-magn@1e {
134		compatible = "st,lis2mdl", "st,lsm303agr-magn";
135		status = "okay";
136		reg = <0x1e>;
137		irq-gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
138	};
139
140	lsm303agr_accel: lsm303agr-accel@19 {
141		compatible = "st,lis2dh", "st,lsm303agr-accel";
142		status = "okay";
143		reg = <0x19>;
144		irq-gpios = <&gpioe 4 GPIO_ACTIVE_HIGH>,
145			  <&gpioe 5 GPIO_ACTIVE_HIGH>;
146	};
147};
148
149&usart2 {
150	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
151	pinctrl-names = "default";
152	current-speed = <115200>;
153	status = "okay";
154};
155
156&rtc {
157	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
158		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
159	status = "okay";
160};
161
162zephyr_udc0: &usbotg_fs {
163	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
164	pinctrl-names = "default";
165	status = "okay";
166};
167
168&flash0 {
169	partitions {
170		compatible = "fixed-partitions";
171		#address-cells = <1>;
172		#size-cells = <1>;
173
174		boot_partition: partition@0 {
175			label = "mcuboot";
176			reg = <0x00000000 DT_SIZE_K(64)>;
177			read-only;
178		};
179
180		slot0_partition: partition@20000 {
181			label = "image-0";
182			reg = <0x00020000 DT_SIZE_K(128)>;
183		};
184
185		slot1_partition: partition@40000 {
186			label = "image-1";
187			reg = <0x00040000 DT_SIZE_K(128)>;
188		};
189
190		scratch_partition: partition@60000 {
191			label = "image-scratch";
192			reg = <0x00060000 DT_SIZE_K(128)>;
193		};
194	};
195};
196