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		green_led_0: led_0 {
28			gpios = <&gpioa 5 GPIO_ACTIVE_LOW>;
29			label = "User LD2";
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			zephyr,code = <INPUT_KEY_0>;
39		};
40	};
41
42	aliases {
43		led0 = &green_led_0;
44		sw0 = &user_button;
45		eeprom-0 = &eeprom;
46		watchdog0 = &iwdg;
47		die-temp0 = &die_temp;
48		volt-sensor0 = &vref;
49	};
50};
51
52&clk_lsi {
53	status = "okay";
54};
55
56&clk_hsi {
57	status = "okay";
58};
59
60&pll {
61	div = <2>;
62	mul = <4>;
63	clocks = <&clk_hsi>;
64	status = "okay";
65};
66
67&rcc {
68	clocks = <&pll>;
69	clock-frequency = <DT_FREQ_M(32)>;
70	ahb-prescaler = <1>;
71	apb1-prescaler = <1>;
72	apb2-prescaler = <1>;
73};
74
75&usart2 {
76	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
77	pinctrl-names = "default";
78	current-speed = <115200>;
79	status = "okay";
80};
81
82&i2c1 {
83	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
84	pinctrl-names = "default";
85	status = "okay";
86};
87
88&spi1 {
89	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
90	pinctrl-names = "default";
91	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
92	status = "okay";
93};
94
95&spi2 {
96	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
97		     &spi2_miso_pb14 &spi2_mosi_pb15>;
98	pinctrl-names = "default";
99	status = "okay";
100};
101
102&spi3 {
103	/* SPI3 on the ST Morpho Connector CN7 pins 17, 1, 2, 3*/
104	pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pc10
105		     &spi3_miso_pc11 &spi3_mosi_pc12>;
106	pinctrl-names = "default";
107	status = "okay";
108};
109
110&eeprom {
111	status = "okay";
112};
113
114&iwdg {
115	status = "okay";
116};
117
118&rtc {
119	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
120		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
121	status = "okay";
122};
123
124&adc1 {
125	pinctrl-0 = <&adc_in0_pa0>;
126	pinctrl-names = "default";
127	st,adc-clock-source = <ASYNC>;
128	st,adc-prescaler = <4>;
129	status = "okay";
130};
131
132&die_temp {
133	status = "okay";
134};
135
136&dac1 {
137	status = "okay";
138	pinctrl-0 = <&dac_out1_pa4>;
139	pinctrl-names = "default";
140};
141
142&flash0 {
143	partitions {
144		compatible = "fixed-partitions";
145		#address-cells = <1>;
146		#size-cells = <1>;
147
148		/* Set 2KB of storage at the end of 512KB flash */
149		storage_partition: partition@7f800 {
150			label = "storage";
151			reg = <0x0007f800 DT_SIZE_K(2)>;
152		};
153	};
154};
155
156&timers3 {
157	status = "okay";
158
159	pwm3: pwm {
160		status = "okay";
161		pinctrl-0 = <&tim3_ch1_pa6>;
162		pinctrl-names = "default";
163	};
164};
165
166&dma1 {
167	status = "okay";
168};
169
170&vref {
171	status = "okay";
172};
173