1/*
2 * Copyright (c) 2018 Centaur Analytics, Inc
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l4/stm32l496Xg.dtsi>
9#include <st/l4/stm32l496z(e-g)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32L496ZG-NUCLEO board";
15	compatible = "st,stm32l496zg-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
27		green_led_1: led_1 {
28			gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>;
29			label = "User LD1";
30		};
31
32		blue_led_2: led_2 {
33			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
34			label = "User LD2";
35		};
36
37		red_led_3: led_3 {
38			gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
39			label = "User LD3";
40		};
41	};
42
43	pwmleds {
44		compatible = "pwm-leds";
45
46		red_pwm_led: red_pwm_led {
47			pwms = <&pwm15 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
48		};
49	};
50
51	gpio_keys {
52		compatible = "gpio-keys";
53
54		user_button: button {
55			label = "User Button";
56			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
57			zephyr,code = <INPUT_KEY_0>;
58		};
59	};
60
61	aliases {
62		led0 = &green_led_1;
63		led1 = &blue_led_2;
64		led2 = &red_led_3;
65		pwm-led0 = &red_pwm_led;
66		sw0 = &user_button;
67		watchdog0 = &wwdg;
68	};
69};
70
71&clk_lsi {
72	status = "okay";
73};
74
75&clk_hsi {
76	status = "okay";
77};
78
79&clk_hsi48 {
80	status = "okay";
81};
82
83&pll {
84	div-m = <1>;
85	mul-n = <20>;
86	div-p = <7>;
87	div-q = <2>;
88	div-r = <4>;
89	clocks = <&clk_hsi>;
90	status = "okay";
91};
92
93&rcc {
94	clocks = <&pll>;
95	clock-frequency = <DT_FREQ_M(80)>;
96	ahb-prescaler = <1>;
97	apb1-prescaler = <1>;
98	apb2-prescaler = <1>;
99};
100
101&usart2 {
102	pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;
103	pinctrl-names = "default";
104	current-speed = <115200>;
105	status = "okay";
106};
107
108&usart3 {
109	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
110	pinctrl-names = "default";
111	current-speed = <115200>;
112	status = "okay";
113};
114
115&lpuart1 {
116	pinctrl-0 = <&lpuart1_tx_pg7 &lpuart1_rx_pg8>;
117	pinctrl-names = "default";
118	current-speed = <115200>;
119	status = "okay";
120};
121
122zephyr_udc0: &usbotg_fs {
123	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
124	pinctrl-names = "default";
125	status = "okay";
126};
127
128&timers1 {
129	st,prescaler = <10000>;
130	status = "okay";
131
132	pwm1: pwm {
133		status = "okay";
134		pinctrl-0 = <&tim1_ch1_pe9
135			     &tim1_ch2_pe11
136			     &tim1_ch3_pe13>;
137		pinctrl-names = "default";
138	};
139};
140
141&timers2 {
142	status = "okay";
143
144	pwm2: pwm {
145		status = "okay";
146		pinctrl-0 = <&tim2_ch1_pa0>;
147		pinctrl-names = "default";
148	};
149};
150
151&timers15 {
152	st,prescaler = <10000>;
153	status = "okay";
154
155	pwm15: pwm {
156		status = "okay";
157		pinctrl-0 = <&tim15_ch1_pb14>;
158		pinctrl-names = "default";
159	};
160};
161
162&i2c1 {
163	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
164	pinctrl-names = "default";
165	status = "okay";
166	clock-frequency = <I2C_BITRATE_FAST>;
167};
168
169&spi1 {
170	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
171	pinctrl-names = "default";
172	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
173	status = "okay";
174};
175
176&rtc {
177	clocks = <&rcc STM32_CLOCK(APB1, 28)>,
178		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
179	status = "okay";
180};
181
182&wwdg {
183	status = "okay";
184};
185