1/*
2 * Copyright (c) 2019 Antony Pavlov <antonynpavlov@gmail.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l1/stm32l152Xe.dtsi>
9#include <st/l1/stm32l152retx-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 STM32L152RE-NUCLEO board";
16	compatible = "st,stm32l152re-nucleo";
17
18	chosen {
19		zephyr,console = &usart2;
20		zephyr,shell-uart = &usart2;
21		zephyr,sram = &sram0;
22		zephyr,flash = &flash0;
23	};
24
25	leds: leds {
26		compatible = "gpio-leds";
27
28		green_led_0: led_0 {
29			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
30			label = "User LD2";
31		};
32	};
33
34	gpio_keys {
35		compatible = "gpio-keys";
36
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_0;
46		sw0 = &user_button;
47		eeprom-0 = &eeprom;
48		watchdog0 = &iwdg;
49		die-temp0 = &die_temp;
50		volt-sensor0 = &vref;
51	};
52};
53
54&clk_lsi {
55	status = "okay";
56};
57
58&clk_hsi {
59	status = "okay";
60};
61
62&pll {
63	div = <2>;
64	mul = <4>;
65	clocks = <&clk_hsi>;
66	status = "okay";
67};
68
69&rcc {
70	clocks = <&pll>;
71	clock-frequency = <DT_FREQ_M(32)>;
72	ahb-prescaler = <1>;
73	apb1-prescaler = <1>;
74	apb2-prescaler = <1>;
75};
76
77&usart2 {
78	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
79	pinctrl-names = "default";
80	current-speed = <115200>;
81	status = "okay";
82};
83
84&i2c1 {
85	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
86	pinctrl-names = "default";
87	status = "okay";
88};
89
90&spi1 {
91	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
92	pinctrl-names = "default";
93	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
94	status = "okay";
95};
96
97&spi2 {
98	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
99		     &spi2_miso_pb14 &spi2_mosi_pb15>;
100	pinctrl-names = "default";
101	status = "okay";
102};
103
104&spi3 {
105	/* SPI3 on the ST Morpho Connector CN7 pins 17, 1, 2, 3*/
106	pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pc10
107		     &spi3_miso_pc11 &spi3_mosi_pc12>;
108	pinctrl-names = "default";
109	status = "okay";
110};
111
112&eeprom {
113	status = "okay";
114};
115
116&iwdg {
117	status = "okay";
118};
119
120&rtc {
121	clocks = <&rcc STM32_CLOCK(APB1, 28)>,
122		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
123	status = "okay";
124};
125
126&adc1 {
127	pinctrl-0 = <&adc_in0_pa0>;
128	pinctrl-names = "default";
129	st,adc-clock-source = "ASYNC";
130	st,adc-prescaler = <4>;
131	status = "okay";
132};
133
134&die_temp {
135	status = "okay";
136};
137
138&dac1 {
139	status = "okay";
140	pinctrl-0 = <&dac_out1_pa4>;
141	pinctrl-names = "default";
142};
143
144&flash0 {
145	partitions {
146		compatible = "fixed-partitions";
147		#address-cells = <1>;
148		#size-cells = <1>;
149
150		/* Set 8KB of storage at the end of 512KB flash */
151		storage_partition: partition@7e000 {
152			label = "storage";
153			reg = <0x0007e000 DT_SIZE_K(8)>;
154		};
155	};
156};
157
158&timers3 {
159	status = "okay";
160
161	pwm3: pwm {
162		status = "okay";
163		pinctrl-0 = <&tim3_ch1_pa6>;
164		pinctrl-names = "default";
165	};
166};
167
168&dma1 {
169	status = "okay";
170};
171
172&vref {
173	status = "okay";
174};
175