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