1/*
2 * Copyright (c) 2017 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l4/stm32l476Xg.dtsi>
9#include <st/l4/stm32l476r(c-e-g)tx-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 STM32L476RG-NUCLEO board";
16	compatible = "st,stm32l476rg-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_2: led_2 {
28			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
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_2;
44		sw0 = &user_button;
45		volt-sensor0 = &vref;
46		volt-sensor1 = &vbat;
47	};
48};
49
50&clk_lsi {
51	status = "okay";
52};
53
54&clk_lse {
55	status = "okay";
56};
57
58&clk_hsi {
59	status = "okay";
60};
61
62&pll {
63	div-m = <1>;
64	mul-n = <20>;
65	div-r = <4>;
66	clocks = <&clk_hsi>;
67	status = "okay";
68};
69
70&rcc {
71	clocks = <&pll>;
72	clock-frequency = <DT_FREQ_M(80)>;
73	ahb-prescaler = <1>;
74	apb1-prescaler = <1>;
75	apb2-prescaler = <1>;
76};
77
78stm32_lp_tick_source: &lptim1 {
79	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
80		 <&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
81	status = "okay";
82};
83
84&usart1 {
85	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
86	pinctrl-names = "default";
87	current-speed = <115200>;
88	status = "okay";
89};
90
91&usart2 {
92	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
93	pinctrl-names = "default";
94	current-speed = <115200>;
95	status = "okay";
96};
97
98&usart3 {
99	pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>;
100	pinctrl-names = "default";
101	current-speed = <115200>;
102};
103
104&i2c1 {
105	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
106	pinctrl-names = "default";
107	status = "okay";
108	clock-frequency = <I2C_BITRATE_FAST>;
109};
110
111&i2c3 {
112	pinctrl-0 = <&i2c3_scl_pc0 &i2c3_sda_pc1>;
113	pinctrl-names = "default";
114	status = "okay";
115	clock-frequency = <I2C_BITRATE_FAST>;
116};
117
118&spi1 {
119	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
120	pinctrl-names = "default";
121	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
122	status = "okay";
123};
124
125&spi2 {
126	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
127		     &spi2_miso_pb14 &spi2_mosi_pb15>;
128	pinctrl-names = "default";
129	status = "okay";
130};
131
132&spi3 {
133	/* SPI3 on the ST Morpho Connector CN7 pins 17, 1, 2, 3*/
134	pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pc10
135		     &spi3_miso_pc11 &spi3_mosi_pc12>;
136	pinctrl-names = "default";
137	status = "okay";
138};
139
140&timers2 {
141	status = "okay";
142
143	pwm2: pwm {
144		status = "okay";
145		pinctrl-0 = <&tim2_ch3_pb10>;
146		pinctrl-names = "default";
147	};
148};
149
150&timers3 {
151	st,prescaler = <10000>;
152	status = "okay";
153
154	pwm3: pwm {
155		status = "okay";
156		pinctrl-0 = <&tim3_ch1_pb4>;
157		pinctrl-names = "default";
158	};
159};
160
161&rtc {
162	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
163		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
164	status = "okay";
165};
166
167&adc1 {
168	pinctrl-0 = <&adc1_in1_pc0>;
169	pinctrl-names = "default";
170	st,adc-clock-source = "SYNC";
171	st,adc-prescaler = <4>;
172	status = "okay";
173};
174
175&vref {
176	status = "okay";
177};
178
179&vbat {
180	status = "okay";
181};
182
183&flash0 {
184	partitions {
185		compatible = "fixed-partitions";
186		#address-cells = <1>;
187		#size-cells = <1>;
188
189		/* Set 32KB of storage at the end of 1024KB flash */
190		storage_partition: partition@f8000 {
191			label = "storage";
192			reg = <0x000f8000 DT_SIZE_K(32)>;
193		};
194	};
195};
196