1/*
2 * Copyright (c) 2017 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f407Xg.dtsi>
9#include <st/f4/stm32f407v(e-g)tx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics STM32F4DISCOVERY board";
14	compatible = "st,stm32f4discovery";
15
16	chosen {
17		zephyr,console = &usart2;
18		zephyr,shell-uart = &usart2;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,ccm = &ccm0;
22		zephyr,canbus = &can2;
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	gpio_keys {
46		compatible = "gpio-keys";
47		user_button: button {
48			label = "Key";
49			gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>;
50			zephyr,code = <INPUT_KEY_0>;
51		};
52	};
53
54	pwmleds: pwmleds {
55		compatible = "pwm-leds";
56
57		orange_pwm_led: orange_pwm_led {
58			pwms = <&pwm4 2 PWM_USEC(100) PWM_POLARITY_NORMAL>;
59		};
60
61		green_pwm_led: green_pwm_led {
62			pwms = <&pwm4 1 PWM_USEC(100) PWM_POLARITY_NORMAL>;
63		};
64
65		red_pwm_led: red_pwm_led {
66			pwms = <&pwm4 3 PWM_USEC(100) PWM_POLARITY_NORMAL>;
67		};
68
69		blue_pwm_led: blue_pwm_led {
70			pwms = <&pwm4 4 PWM_USEC(100) PWM_POLARITY_NORMAL>;
71		};
72	};
73
74	aliases {
75		led0 = &green_led_4;
76		led1 = &orange_led_3;
77		led2 = &red_led_5;
78		led3 = &blue_led_6;
79		sw0 = &user_button;
80		die-temp0 = &die_temp;
81		volt-sensor0 = &vref;
82		volt-sensor1 = &vbat;
83	};
84};
85
86&usart1 {
87	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
88	pinctrl-names = "default";
89	current-speed = <115200>;
90	status = "okay";
91};
92
93&clk_lsi {
94	status = "okay";
95};
96
97&clk_hse {
98	clock-frequency = <DT_FREQ_M(8)>;
99	status = "okay";
100};
101
102&pll {
103	div-m = <8>;
104	mul-n = <336>;
105	div-p = <2>;
106	div-q = <7>;
107	clocks = <&clk_hse>;
108	status = "okay";
109};
110
111&rcc {
112	clocks = <&pll>;
113	clock-frequency = <DT_FREQ_M(168)>;
114	ahb-prescaler = <1>;
115	apb1-prescaler = <4>;
116	apb2-prescaler = <2>;
117};
118
119&usart2 {
120	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
121	pinctrl-names = "default";
122	current-speed = <115200>;
123	status = "okay";
124};
125
126&timers2 {
127	status = "okay";
128
129	pwm2: pwm {
130		status = "okay";
131		pinctrl-0 = <&tim2_ch1_pa0>;
132		pinctrl-names = "default";
133	};
134};
135
136&timers4 {
137	status = "okay";
138
139	pwm4: pwm {
140		status = "okay";
141		pinctrl-0 = <&tim4_ch1_pd12 &tim4_ch2_pd13 &tim4_ch3_pd14 &tim4_ch4_pd15>;
142		pinctrl-names = "default";
143	};
144};
145
146&rtc {
147	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
148		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
149	status = "okay";
150
151	backup_regs {
152		status = "okay";
153	};
154};
155
156zephyr_udc0: &usbotg_fs {
157	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
158	pinctrl-names = "default";
159	status = "okay";
160};
161
162&can1 {
163	pinctrl-0 = <&can1_rx_pb8 &can1_tx_pb9>;
164	pinctrl-names = "default";
165	status = "disabled";
166};
167
168&can2 {
169	pinctrl-0 = <&can2_rx_pb5 &can2_tx_pb13>;
170	pinctrl-names = "default";
171	status = "okay";
172};
173
174&adc1 {
175	st,adc-prescaler = <2>;
176	status = "okay";
177};
178
179&die_temp {
180	status = "okay";
181};
182
183&vref {
184	status = "okay";
185};
186
187&vbat {
188	status = "okay";
189};
190