1/*
2 * Copyright (c) 2019 Philippe Retornaz <philippe@shapescale.com>
3 * Copyright (c) 2019 STMicroelectronics
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <st/g0/stm32g071Xb.dtsi>
10#include <st/g0/stm32g071r(6-8-b)tx-pinctrl.dtsi>
11#include "arduino_r3_connector.dtsi"
12
13/ {
14	model = "STMicroelectronics STM32G071RB-NUCLEO board";
15	compatible = "st,stm32g071rb-nucleo";
16
17	chosen {
18		zephyr,console = &usart2;
19		zephyr,shell-uart = &usart2;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24
25	leds {
26		compatible = "gpio-leds";
27		green_led_1: led_4 {
28			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
29			label = "User LD4";
30		};
31	};
32
33	gpio_keys {
34		compatible = "gpio-keys";
35		user_button: button {
36			label = "User";
37			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
38		};
39	};
40
41	aliases {
42		led0 = &green_led_1;
43		sw0 = &user_button;
44		watchdog0 = &iwdg;
45		die-temp0 = &die_temp;
46		volt-sensor0 = &vref;
47		volt-sensor1 = &vbat;
48	};
49};
50
51&clk_lsi {
52	status = "okay";
53};
54
55&clk_hsi {
56	status = "okay";
57};
58
59&pll {
60	div-m = <1>;
61	mul-n = <8>;
62	div-p = <2>;
63	div-q = <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	status = "okay";
94};
95
96&iwdg {
97	status = "okay";
98};
99
100&timers3 {
101	st,prescaler = <10000>;
102	status = "okay";
103	pwm3: pwm {
104		status = "okay";
105		pinctrl-0 = <&tim3_ch1_pa6>;
106		pinctrl-names = "default";
107	};
108};
109
110&i2c1 {
111	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
112	pinctrl-names = "default";
113	status = "okay";
114	clock-frequency = <I2C_BITRATE_FAST>;
115};
116
117&i2c2 {
118	pinctrl-0 = <&i2c2_scl_pa11 &i2c2_sda_pa12>;
119	pinctrl-names = "default";
120	status = "okay";
121	clock-frequency = <I2C_BITRATE_FAST>;
122};
123
124&spi1 {
125	pinctrl-0 = <&spi1_nss_pb0 &spi1_sck_pa5
126		     &spi1_miso_pa6 &spi1_mosi_pa7>;
127	pinctrl-names = "default";
128	status = "okay";
129};
130
131&spi2 {
132	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
133		     &spi2_miso_pb14 &spi2_mosi_pb15>;
134	pinctrl-names = "default";
135	status = "okay";
136};
137
138&adc1 {
139	pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1>;
140	pinctrl-names = "default";
141	status = "okay";
142	vref-mv = <3300>;
143};
144
145&dac1 {
146	status = "okay";
147	pinctrl-0 = <&dac1_out1_pa4>;
148	pinctrl-names = "default";
149};
150
151&die_temp {
152	status = "okay";
153};
154
155&flash0 {
156	partitions {
157		compatible = "fixed-partitions";
158		#address-cells = <1>;
159		#size-cells = <1>;
160
161		/* Set 2KB of storage at the end of 128KB flash */
162		storage_partition: partition@1f800 {
163			label = "storage";
164			reg = <0x0001f800 DT_SIZE_K(2)>;
165		};
166	};
167};
168
169&cpu0 {
170	cpu-power-states = <&stop0 &stop1>;
171};
172
173&lptim1 {
174	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
175		 <&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
176	status = "okay";
177};
178
179&vref {
180	status = "okay";
181};
182
183&vbat {
184	status = "okay";
185};
186