1/*
2 * Copyright (c) 2017 Florian Vaussard, HEIG-VD
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f412Xg.dtsi>
9#include <st/f4/stm32f412z(e-g)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32F412ZG-NUCLEO board";
15	compatible = "st,stm32f412zg-nucleo";
16
17	chosen {
18		zephyr,console = &usart3;
19		zephyr,shell-uart = &usart3;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24	leds: leds {
25		compatible = "gpio-leds";
26		green_led_1: led_1 {
27			gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
28			label = "User LD1";
29		};
30		blue_led_1: led_2 {
31			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
32			label = "User LD2";
33		};
34		red_led_1: led_3 {
35			gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
36			label = "User LD3";
37		};
38	};
39
40	gpio_keys {
41		compatible = "gpio-keys";
42		user_button: button {
43			label = "User";
44			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
45			zephyr,code = <INPUT_KEY_0>;
46		};
47	};
48
49	aliases {
50		led0 = &green_led_1;
51		led1 = &blue_led_1;
52		led2 = &red_led_1;
53		sw0 = &user_button;
54	};
55};
56
57&clk_lsi {
58	status = "okay";
59};
60
61&clk_hse {
62	hse-bypass;
63	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
64	status = "okay";
65};
66
67&pll {
68	div-m = <8>;
69	mul-n = <384>;
70	div-p = <4>;
71	div-q = <8>;
72	clocks = <&clk_hse>;
73	status = "okay";
74};
75
76&rcc {
77	clocks = <&pll>;
78	clock-frequency = <DT_FREQ_M(96)>;
79	ahb-prescaler = <1>;
80	apb1-prescaler = <2>;
81	apb2-prescaler = <1>;
82};
83
84&usart3 {
85	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
86	pinctrl-names = "default";
87	current-speed = <115200>;
88	status = "okay";
89};
90
91&usart6 {
92	pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
93	pinctrl-names = "default";
94	current-speed = <115200>;
95	status = "okay";
96};
97
98&i2c1 {
99	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
100	pinctrl-names = "default";
101	status = "okay";
102	clock-frequency = <I2C_BITRATE_FAST>;
103};
104
105&spi1 {
106	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
107	pinctrl-names = "default";
108	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
109	status = "okay";
110};
111
112zephyr_udc0: &usbotg_fs {
113	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
114	pinctrl-names = "default";
115	status = "okay";
116};
117
118&timers2 {
119	status = "okay";
120
121	pwm2: pwm {
122		status = "okay";
123		pinctrl-0 = <&tim2_ch1_pa0>;
124		pinctrl-names = "default";
125	};
126};
127
128&rtc {
129	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
130		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
131	status = "okay";
132};
133