1/*
2 * Copyright (c) 2018 Ilya Tagunov <tagunil@gmail.com>
3 * Copyright (c) 2024 STMicroelectronics
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <st/l0/stm32l073Xz.dtsi>
10#include <st/l0/stm32l073r(b-z)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 STM32L073RZ-NUCLEO board";
17	compatible = "st,stm32l073rz-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		green_led_2: led_2 {
29			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
30			label = "User LD2";
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	pwmleds: pwmleds {
44		compatible = "pwm-leds";
45		/* NOTE: disabled by default, PWM2 conflicts with SPI1 */
46		status = "disabled";
47
48		green_pwm_led: green_pwm_led {
49			pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
50		};
51	};
52
53	aliases {
54		led0 = &green_led_2;
55		sw0 = &user_button;
56		pwm-led0 = &green_pwm_led;
57		watchdog0 = &iwdg;
58		eeprom-0 = &eeprom;
59		die-temp0 = &die_temp;
60		volt-sensor0 = &vref;
61	};
62};
63
64&clk_hse {
65	hse-bypass;
66	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
67	status = "okay";
68};
69
70&clk_lsi {
71	status = "okay";
72};
73
74&clk_hsi48 {
75	status = "okay";
76};
77
78&pll {
79	div = <2>;
80	mul = <8>;
81	clocks = <&clk_hse>;
82	status = "okay";
83};
84
85&rcc {
86	clocks = <&pll>;
87	clock-frequency = <DT_FREQ_M(32)>;
88	ahb-prescaler = <1>;
89	apb1-prescaler = <1>;
90	apb2-prescaler = <1>;
91};
92
93stm32_lp_tick_source: &lptim1 {
94	/*
95	 * LSI freq is 37KHz but stm32_lptim driver is using 32000Hz
96	 * resulting in time running 1.13 faster than reality
97	 */
98	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
99		<&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
100	status = "okay";
101};
102
103&usart1 {
104	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
105	pinctrl-names = "default";
106	current-speed = <115200>;
107};
108
109&usart2 {
110	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
111	pinctrl-names = "default";
112	current-speed = <115200>;
113	status = "okay";
114};
115
116&i2c1 {
117	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
118	pinctrl-names = "default";
119	status = "okay";
120	clock-frequency = <I2C_BITRATE_FAST>;
121};
122
123&i2c2 {
124	pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
125	pinctrl-names = "default";
126	status = "okay";
127	clock-frequency = <I2C_BITRATE_FAST>;
128};
129
130&spi1 {
131	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
132	pinctrl-names = "default";
133	status = "okay";
134};
135
136&iwdg {
137	status = "okay";
138};
139
140&adc1 {
141	pinctrl-0 = <&adc_in0_pa0>;
142	pinctrl-names = "default";
143	st,adc-clock-source = "SYNC";
144	st,adc-prescaler = <4>;
145	status = "okay";
146};
147
148&die_temp {
149	status = "okay";
150};
151
152&dac1 {
153	status = "okay";
154	pinctrl-0 = <&dac_out1_pa4>;
155	pinctrl-names = "default";
156};
157
158&timers2 {
159	st,prescaler = <10000>;
160	status = "okay";
161
162	pwm2: pwm {
163		/* NOTE: disabled by default, PWM2 conflicts with SPI1 */
164		pinctrl-0 = <&tim2_ch1_pa5>;
165		pinctrl-names = "default";
166	};
167};
168
169&rtc {
170	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
171		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
172	status = "okay";
173};
174
175&rng {
176	status = "okay";
177};
178
179&eeprom {
180	status = "okay";
181};
182
183&vref {
184	status = "okay";
185};
186