1/*
2 * Copyright (c) 2023 Marin Jurjević <marin.jurjevic@hotmail.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/g0/stm32g070Xb.dtsi>
9#include <st/g0/stm32g070rbtx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include "st_morpho_connector.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "STMicroelectronics STM32G070RB-NUCLEO board";
16	compatible = "st,stm32g070rb-nucleo";
17
18	chosen {
19		zephyr,console = &usart2;
20		zephyr,shell-uart = &usart2;
21		zephyr,sram = &sram0;
22		zephyr,flash = &flash0;
23	};
24
25
26	leds: leds {
27		compatible = "gpio-leds";
28		green_led_1: led_4 {
29			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
30			label = "User LD4";
31		};
32	};
33
34	gpio_keys {
35		compatible = "gpio-keys";
36		user_button: button {
37			label = "User";
38			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
39			zephyr,code = <INPUT_KEY_0>;
40		};
41	};
42
43	aliases {
44		led0 = &green_led_1;
45		sw0 = &user_button;
46		watchdog0 = &iwdg;
47		die-temp0 = &die_temp;
48		volt-sensor0 = &vref;
49	};
50};
51
52&clk_lsi {
53	status = "okay";
54};
55
56&clk_hsi {
57	status = "okay";
58};
59
60&pll {
61	div-m = <1>;
62	mul-n = <8>;
63	div-p = <2>;
64	div-r = <2>;
65	clocks = <&clk_hsi>;
66	status = "okay";
67};
68
69&rcc {
70	clocks = <&pll>;
71	clock-frequency = <DT_FREQ_M(64)>;
72	ahb-prescaler = <1>;
73	apb1-prescaler = <1>;
74};
75
76&usart1 {
77	pinctrl-0 = <&usart1_tx_pc4 &usart1_rx_pc5>;
78	pinctrl-names = "default";
79	current-speed = <115200>;
80	status = "okay";
81};
82
83&usart2 {
84	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
85	pinctrl-names = "default";
86	current-speed = <115200>;
87	status = "okay";
88};
89
90&rtc {
91	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>,
92		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
93
94	status = "okay";
95};
96
97&iwdg {
98	status = "okay";
99};
100
101&timers3 {
102	st,prescaler = <10000>;
103	status = "okay";
104	pwm3: pwm {
105		status = "okay";
106		pinctrl-0 = <&tim3_ch1_pa6>;
107		pinctrl-names = "default";
108	};
109};
110
111&i2c1 {
112	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
113	pinctrl-names = "default";
114	status = "okay";
115	clock-frequency = <I2C_BITRATE_FAST>;
116};
117
118&i2c2 {
119	pinctrl-0 = <&i2c2_scl_pa11 &i2c2_sda_pa12>;
120	pinctrl-names = "default";
121	status = "okay";
122	clock-frequency = <I2C_BITRATE_FAST>;
123};
124
125&spi1 {
126	pinctrl-0 = <&spi1_nss_pb0 &spi1_sck_pa5
127		     &spi1_miso_pa6 &spi1_mosi_pa7>;
128	pinctrl-names = "default";
129	status = "okay";
130};
131
132&spi2 {
133	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
134		     &spi2_miso_pb14 &spi2_mosi_pb15>;
135	pinctrl-names = "default";
136	status = "okay";
137};
138
139&adc1 {
140	pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1>;
141	pinctrl-names = "default";
142	st,adc-clock-source = <SYNC>;
143	st,adc-prescaler = <4>;
144	status = "okay";
145	vref-mv = <3300>;
146};
147
148&die_temp {
149	status = "okay";
150};
151
152&flash0 {
153	partitions {
154		compatible = "fixed-partitions";
155		#address-cells = <1>;
156		#size-cells = <1>;
157
158		/* Set 2KB of storage at the end of 128KB flash */
159		storage_partition: partition@1f800 {
160			label = "storage";
161			reg = <0x0001f800 DT_SIZE_K(2)>;
162		};
163	};
164};
165
166&vref {
167	status = "okay";
168};
169