1/*
2 * Copyright (c) 2024 Ian Morris
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f415Rg.dtsi>
9#include <st/f4/stm32f415rgtx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "Mikroe STM32 M4 Clicker";
14	compatible = "st,stm32f415rg";
15
16	chosen {
17		zephyr,sram = &sram0;
18		zephyr,flash = &flash0;
19	};
20
21	leds {
22		compatible = "gpio-leds";
23		ld1: led_1 {
24			gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>;
25			label = "User LED 1";
26		};
27		ld2: led_2 {
28			gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>;
29			label = "User LED 2";
30		};
31	};
32
33	gpio_keys {
34		compatible = "gpio-keys";
35		btn1: button_1 {
36			label = "User Button 1";
37			gpios = <&gpioc 0 GPIO_ACTIVE_LOW>;
38			zephyr,code = <INPUT_KEY_0>;
39		};
40		btn2: button_2 {
41			label = "User Button 2";
42			gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
43			zephyr,code = <INPUT_KEY_0>;
44		};
45	};
46
47	mikrobus_header: mikrobus-connector {
48		compatible = "mikro-bus";
49		#gpio-cells = <2>;
50		gpio-map-mask = <0xffffffff 0xffffffc0>;
51		gpio-map-pass-thru = <0 0x3f>;
52		gpio-map =	<0 0 &gpioa 0 0>,	/* AN  */
53				<1 0 &gpiob 5 0>,	/* RST */
54				<2 0 &gpiob 12 0>,	/* CS   */
55				<3 0 &gpiob 13 0>,	/* SCK  */
56				<4 0 &gpiob 14 0>,	/* MISO */
57				<5 0 &gpiob 15 0>,	/* MOSI */
58							/* +3.3V */
59							/* GND */
60				<6 0 &gpiob 0 0>,	/* PWM  */
61				<7 0 &gpiob 1 0>,	/* INT  */
62				<8 0 &gpioc 11 0>,	/* RX   */
63				<9 0 &gpioc 10 0>,	/* TX   */
64				<10 0 &gpiob 10 0>,	/* SCL  */
65				<11 0 &gpiob 11 0>;	/* SDA  */
66							/* +5V */
67							/* GND */
68	};
69
70	aliases {
71		led0 = &ld1;
72		led1 = &ld2;
73		sw0 = &btn1;
74	};
75};
76
77&clk_lsi {
78	status = "okay";
79};
80
81&clk_hse {
82	clock-frequency = <DT_FREQ_M(16)>;
83	status = "okay";
84};
85
86&pll {
87	div-m = <16>;
88	mul-n = <336>;
89	div-p = <2>;
90	div-q = <7>;
91	clocks = <&clk_hse>;
92	status = "okay";
93};
94
95&rcc {
96	clocks = <&pll>;
97	clock-frequency = <DT_FREQ_M(168)>;
98	ahb-prescaler = <1>;
99	apb1-prescaler = <4>;
100	apb2-prescaler = <2>;
101};
102
103&usart3 {
104	pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>;
105	pinctrl-names = "default";
106	current-speed = <115200>;
107	status = "okay";
108};
109
110&i2c2 {
111	pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
112	pinctrl-names = "default";
113	status = "okay";
114};
115
116&spi2 {
117	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
118				&spi2_miso_pb14 &spi2_mosi_pb15>;
119		pinctrl-names = "default";
120		status = "okay";
121};
122
123zephyr_udc0: &usbotg_fs {
124	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
125	pinctrl-names = "default";
126	status = "okay";
127};
128
129#include <../boards/common/usb/cdc_acm_serial.dtsi>
130
131mikrobus_spi: &spi2 {};
132mikrobus_serial: &usart3 {};
133mikrobus_i2c: &i2c2 {};
134