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
27		green_led_4: led_4 {
28			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
29			label = "User LD4";
30		};
31	};
32
33	pwmleds {
34		compatible = "pwm-leds";
35
36		green_pwm_led: green_pwm_led {
37			pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
38		};
39	};
40
41	gpio_keys {
42		compatible = "gpio-keys";
43
44		user_button: button {
45			label = "user button";
46			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
47			status = "okay";
48			zephyr,code = <INPUT_KEY_0>;
49		};
50	};
51
52	aliases {
53		led0 = &green_led_4;
54		pwm-led0 = &green_pwm_led;
55		sw0 = &user_button;
56		watchdog0 = &iwdg;
57		die-temp0 = &die_temp;
58		volt-sensor0 = &vref;
59	};
60};
61
62&clk_lse {
63	status = "okay";
64};
65
66&clk_hse {
67	clock-frequency = <DT_FREQ_M(48)>;
68	status = "okay";
69};
70
71&rcc {
72	clocks = <&clk_hse>;
73	clock-frequency = <DT_FREQ_M(48)>;
74	ahb-prescaler = <1>;
75	apb1-prescaler = <1>;
76};
77
78&usart1 {
79	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
80	pinctrl-names = "default";
81	current-speed = <115200>;
82};
83
84&usart2 {
85	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
86	pinctrl-names = "default";
87	current-speed = <115200>;
88	status = "okay";
89};
90
91&rtc {
92	clocks = <&rcc STM32_CLOCK(APB1, 10)>,
93		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
94	status = "okay";
95};
96
97&iwdg {
98	status = "okay";
99};
100
101&timers1 {
102	st,prescaler = <10000>;
103	status = "okay";
104
105	pwm1: pwm {
106		pinctrl-0 = <&tim1_ch1_pa5>;
107		pinctrl-names = "default";
108		status = "okay";
109	};
110};
111
112&i2c1 {
113	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
114	pinctrl-names = "default";
115	status = "okay";
116	clock-frequency = <I2C_BITRATE_FAST>;
117};
118
119&adc1 {
120	pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1 &adc1_in4_pa4>;
121	pinctrl-names = "default";
122	st,adc-clock-source = "SYNC";
123	st,adc-prescaler = <4>;
124	status = "okay";
125};
126
127&die_temp {
128	status = "okay";
129};
130
131&vref {
132	status = "okay";
133};
134
135&dma1 {
136	status = "okay";
137};
138
139&dmamux1 {
140	status = "okay";
141};
142