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