1/*
2 * Copyright (c) 2023 STMicroelectronics
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f0/stm32f042X6.dtsi>
9#include <st/f0/stm32f042k(4-6)tx-pinctrl.dtsi>
10
11/ {
12	model = "STMicroelectronics STM32F042K6-NUCLEO board";
13	compatible = "st,stm32f042k6-nucleo";
14
15	chosen {
16		zephyr,console = &usart2;
17		zephyr,shell-uart = &usart2;
18		zephyr,sram = &sram0;
19		zephyr,flash = &flash0;
20	};
21
22	leds: leds {
23		compatible = "gpio-leds";
24		green_led_3: led_3 {
25			gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>;
26			label = "User LD3";
27		};
28	};
29
30	pwmleds {
31		compatible = "pwm-leds";
32		green_pwm_led: green_pwm_led {
33			pwms = <&pwm3 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
34		};
35	};
36
37	aliases {
38		led0 = &green_led_3;
39		pwm-led0 = &green_pwm_led;
40		volt-sensor0 = &vref;
41		volt-sensor1 = &vbat;
42	};
43};
44
45&clk_lsi {
46	status = "okay";
47};
48
49&clk_hsi {
50	status = "okay";
51};
52
53&pll {
54	prediv = <1>;
55	mul = <6>;
56	clocks = <&clk_hsi>;
57	status = "okay";
58};
59
60&rcc {
61	clocks = <&pll>;
62	clock-frequency = <DT_FREQ_M(48)>;
63	ahb-prescaler = <1>;
64	apb1-prescaler = <1>;
65};
66
67&timers3 {
68	status = "okay";
69	st,prescaler = <10000>;
70
71	pwm3: pwm {
72		status = "okay";
73		pinctrl-0 = <&tim3_ch3_pb0>;
74		pinctrl-names = "default";
75	};
76};
77
78&usart2 {
79	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa15>;
80	pinctrl-names = "default";
81	current-speed = <115200>;
82	status = "okay";
83};
84
85&i2c1 {
86	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
87	pinctrl-names = "default";
88	status = "okay";
89	clock-frequency = <I2C_BITRATE_FAST>;
90};
91
92&spi1 {
93	pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
94	pinctrl-names = "default";
95	cs-gpios = <&gpioa 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
96	status = "okay";
97};
98
99&adc1 {
100	pinctrl-0 = <&adc_in0_pa0>;
101	pinctrl-names = "default";
102	st,adc-clock-source = "SYNC";
103	st,adc-prescaler = <4>;
104	status = "okay";
105};
106
107&rtc {
108	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
109		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
110	status = "okay";
111};
112
113&vref {
114	status = "okay";
115};
116
117&vbat {
118	status = "okay";
119};
120
121zephyr_udc0: &usb {
122	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
123	pinctrl-names = "default";
124	status = "okay";
125};
126