1/*
2 * Copyright (c) 2023 Benjamin Björnsson <benjamin.bjornsson@gmail.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/c0/stm32c031X6.dtsi>
9#include <st/c0/stm32c031c(4-6)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32C031C6-NUCLEO board";
15	compatible = "st,stm32c031c6-nucleo";
16
17	chosen {
18		zephyr,console = &usart2;
19		zephyr,shell-uart = &usart2;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24	leds: leds {
25		compatible = "gpio-leds";
26		green_led_4: led_4 {
27			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
28			label = "User LD4";
29		};
30	};
31
32	pwmleds {
33		compatible = "pwm-leds";
34
35		green_pwm_led: green_pwm_led {
36			pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
37		};
38	};
39
40	gpio_keys {
41		compatible = "gpio-keys";
42		user_button: button {
43			label = "user button";
44			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
45			status = "okay";
46			zephyr,code = <INPUT_KEY_0>;
47		};
48	};
49
50	aliases {
51		led0 = &green_led_4;
52		pwm-led0 = &green_pwm_led;
53		sw0 = &user_button;
54		watchdog0 = &iwdg;
55		die-temp0 = &die_temp;
56		volt-sensor0 = &vref;
57	};
58};
59
60&clk_lse {
61	status = "okay";
62};
63
64&clk_hse {
65	clock-frequency = <DT_FREQ_M(48)>;
66	status = "okay";
67};
68
69&rcc {
70	clocks = <&clk_hse>;
71	clock-frequency = <DT_FREQ_M(48)>;
72	ahb-prescaler = <1>;
73	apb1-prescaler = <1>;
74};
75
76&usart1 {
77	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
78	pinctrl-names = "default";
79	current-speed = <115200>;
80};
81
82&usart2 {
83	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
84	pinctrl-names = "default";
85	current-speed = <115200>;
86	status = "okay";
87};
88
89&rtc {
90	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>,
91		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
92	status = "okay";
93};
94
95&iwdg {
96	status = "okay";
97};
98
99&timers1 {
100	st,prescaler = <10000>;
101	status = "okay";
102
103	pwm1: pwm {
104		pinctrl-0 = <&tim1_ch1_pa5>;
105		pinctrl-names = "default";
106		status = "okay";
107	};
108};
109
110&i2c1 {
111	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
112	pinctrl-names = "default";
113	status = "okay";
114	clock-frequency = <I2C_BITRATE_FAST>;
115};
116
117&adc1 {
118	pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1 &adc1_in4_pa4>;
119	pinctrl-names = "default";
120	st,adc-clock-source = <SYNC>;
121	st,adc-prescaler = <4>;
122	status = "okay";
123};
124
125&die_temp {
126	status = "okay";
127};
128
129&vref {
130	status = "okay";
131};
132
133&dma1 {
134	status = "okay";
135};
136
137&dmamux1 {
138	status = "okay";
139};
140