1/*
2 * Copyright (c) 2020 Trifork
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 = "MikroE clicker 2 for STM32";
14	compatible = "mikroe,stm32-e407", "st,stm32f407";
15
16	chosen {
17		zephyr,console = &uart4;
18		zephyr,shell-uart = &uart4;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,ccm = &ccm0;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		ld1: led_1 {
27			gpios = <&gpioe 12 GPIO_ACTIVE_HIGH>;
28			label = "User LD1";
29		};
30		ld2: led_2 {
31			gpios = <&gpioe 15 GPIO_ACTIVE_HIGH>;
32			label = "User LD2";
33		};
34	};
35
36	gpio_keys {
37		compatible = "gpio-keys";
38		user_button_0: key_0 {
39			label = "Key PE0";
40			gpios = <&gpioe 0 GPIO_ACTIVE_LOW>;
41			zephyr,code = <INPUT_KEY_0>;
42		};
43		user_button_1: key_1 {
44			label = "Key K1";
45			gpios = <&gpioe 10 GPIO_ACTIVE_LOW>;
46			zephyr,code = <INPUT_KEY_1>;
47		};
48	};
49
50	aliases {
51		led0 = &ld1;
52		led1 = &ld2;
53		sw0 = &user_button_0;
54		sw1 = &user_button_1;
55		volt-sensor0 = &vref;
56		volt-sensor1 = &vbat;
57	};
58};
59
60&clk_lsi {
61	status = "okay";
62};
63
64&clk_hse {
65	clock-frequency = <DT_FREQ_M(25)>;
66	status = "okay";
67};
68
69&pll {
70	div-m = <25>;
71	mul-n = <336>;
72	div-p = <2>;
73	div-q = <7>;
74	clocks = <&clk_hse>;
75	status = "okay";
76};
77
78&rcc {
79	clocks = <&pll>;
80	clock-frequency = <DT_FREQ_M(168)>;
81	ahb-prescaler = <1>;
82	apb1-prescaler = <4>;
83	apb2-prescaler = <2>;
84};
85
86&usart2 {
87	pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;
88	pinctrl-names = "default";
89	current-speed = <9600>;
90	status = "okay";
91};
92
93&usart3 {
94	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
95	pinctrl-names = "default";
96	current-speed = <9600>;
97	status = "okay";
98};
99
100&uart4 {
101	pinctrl-0 = <&uart4_tx_pa0 &uart4_rx_pa1>;
102	pinctrl-names = "default";
103	current-speed = <115200>;
104	status = "okay";
105};
106
107&rtc {
108	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
109		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
110	status = "okay";
111};
112
113zephyr_udc0: &usbotg_fs {
114	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
115	pinctrl-names = "default";
116	status = "okay";
117};
118
119&spi2 {
120	pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
121	pinctrl-names = "default";
122	cs-gpios = <&gpioe 11 GPIO_ACTIVE_LOW>;
123	status = "okay";
124};
125
126&spi3 {
127	pinctrl-0 = <&spi3_sck_pc10 &spi3_miso_pc11 &spi3_mosi_pc12>;
128	pinctrl-names = "default";
129	cs-gpios = <&gpioe 8 GPIO_ACTIVE_LOW>;
130	status = "okay";
131};
132
133&i2c2 {
134	pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
135	pinctrl-names = "default";
136	status = "okay";
137};
138
139&i2c3 {
140	pinctrl-0 = <&i2c3_scl_pa8 &i2c3_sda_pc9>;
141	pinctrl-names = "default";
142	status = "okay";
143};
144
145&adc1 {
146	status ="okay";
147	pinctrl-0 = <&adc1_in2_pa2 &adc1_in3_pa3>;
148	pinctrl-names = "default";
149	st,adc-clock-source = "SYNC";
150	st,adc-prescaler = <2>;
151};
152
153&vref {
154	status = "okay";
155};
156
157&vbat {
158	status = "okay";
159};
160
161mikrobus_1_i2c: &i2c3 {};
162
163mikrobus_1_spi: &spi3 {};
164
165mikrobus_1_uart: &usart2 {};
166
167mikrobus_2_i2c: &i2c2 {};
168
169mikrobus_2_spi: &spi2 {};
170
171mikrobus_2_uart: &usart3 {};
172