1/*
2 * Copyright (c) 2018 Pushpal Sidhu
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l4/stm32l4r5Xi.dtsi>
9#include <st/l4/stm32l4r5z(g-i)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32L4R5ZI-NUCLEO board";
15	compatible = "st,stm32l4r5zi-nucleo";
16
17	chosen {
18		zephyr,console = &lpuart1;
19		zephyr,shell-uart = &lpuart1;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24	leds: leds {
25		compatible = "gpio-leds";
26		green_led_0: led_0 {
27			gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>;
28			label = "User LD1";
29		};
30
31		blue_led_0: led_1 {
32			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
33			label = "User LD2";
34		};
35
36		red_led_0: led_2 {
37			gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
38			label = "User LD3";
39		};
40	};
41
42	gpio_keys {
43		compatible = "gpio-keys";
44		user_button: button {
45			label = "User";
46			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
47			zephyr,code = <INPUT_KEY_0>;
48		};
49	};
50
51	pwmleds: pwmleds {
52		compatible = "pwm-leds";
53		/* NOTE: disabled by default, PWM1 conflicts with SPI2 */
54		status = "disabled";
55
56		red_pwm_led: red_pwm_led {
57			pwms = <&pwm1 2 PWM_MSEC(20) (PWM_POLARITY_NORMAL |
58						      STM32_PWM_COMPLEMENTARY)>;
59		};
60	};
61
62	aliases {
63		led0 = &green_led_0;
64		led1 = &blue_led_0;
65		led2 = &red_led_0;
66		sw0 = &user_button;
67		pwm-led0 = &red_pwm_led;
68		volt-sensor0 = &vref;
69		volt-sensor1 = &vbat;
70	};
71};
72
73&clk_lsi {
74	status = "okay";
75};
76
77&clk_hsi {
78	status = "okay";
79};
80
81&clk_hsi48 {
82	status = "okay";
83};
84
85&pll {
86	div-m = <4>;
87	mul-n = <40>;
88	div-p = <7>;
89	div-q = <2>;
90	div-r = <2>;
91	clocks = <&clk_hsi>;
92	status = "okay";
93};
94
95&rcc {
96	clocks = <&pll>;
97	clock-frequency = <DT_FREQ_M(80)>;
98	ahb-prescaler = <1>;
99	apb1-prescaler = <1>;
100	apb2-prescaler = <1>;
101};
102
103&usart1 {
104	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
105	pinctrl-names = "default";
106	current-speed = <115200>;
107	status = "okay";
108};
109
110&usart2 {
111	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
112	pinctrl-names = "default";
113	current-speed = <115200>;
114	status = "okay";
115};
116
117&usart3 {
118	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
119	pinctrl-names = "default";
120	current-speed = <115200>;
121	status = "okay";
122};
123
124&lpuart1 {
125	pinctrl-0 = <&lpuart1_tx_pg7 &lpuart1_rx_pg8>;
126	pinctrl-names = "default";
127	current-speed = <115200>;
128	status = "okay";
129};
130
131&i2c1 {
132	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
133	pinctrl-names = "default";
134	status = "okay";
135};
136
137&spi1 {
138	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
139	pinctrl-names = "default";
140	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
141	status = "okay";
142};
143
144&spi2 {
145	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
146		     &spi2_miso_pb14 &spi2_mosi_pb15>;
147	pinctrl-names = "default";
148	status = "okay";
149};
150
151&spi3 {
152	/* SPI3 on the ST Morpho Connector CN7 pins 17, 1, 2, 3*/
153	pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pc10
154		     &spi3_miso_pc11 &spi3_mosi_pc12>;
155	pinctrl-names = "default";
156	status = "okay";
157};
158
159zephyr_udc0: &usbotg_fs {
160	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12
161		     &usb_otg_fs_id_pa10>;
162	pinctrl-names = "default";
163	status = "okay";
164};
165
166&timers1 {
167	status = "okay";
168
169	pwm1: pwm {
170		/* NOTE: disabled by default, PWM1 conflicts with SPI2 */
171		pinctrl-0 = <&tim1_ch2n_pb14>;
172		pinctrl-names = "default";
173	};
174};
175
176&timers2 {
177	status = "okay";
178
179	pwm2: pwm {
180		status = "okay";
181		pinctrl-0 = <&tim2_ch1_pa0>;
182		pinctrl-names = "default";
183	};
184};
185
186&rtc {
187	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
188		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
189	status = "okay";
190};
191
192&flash0 {
193	partitions {
194		compatible = "fixed-partitions";
195		#address-cells = <1>;
196		#size-cells = <1>;
197
198		/* Reserve last 16KiB for property storage */
199		storage_partition: partition@1FB000 {
200			label = "storage";
201			reg = <0x001FB000 DT_SIZE_K(16)>;
202		};
203	};
204};
205
206&adc1 {
207	pinctrl-0 = <&adc1_in1_pc0>;
208	pinctrl-names = "default";
209	st,adc-clock-source = <SYNC>;
210	st,adc-prescaler = <4>;
211	status = "okay";
212};
213
214&vref {
215	status = "okay";
216};
217
218&vbat {
219	status = "okay";
220};
221