1/*
2 * Copyright (c) 2017 Bobby Noelte
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f0/stm32f091Xc.dtsi>
9#include <st/f0/stm32f091r(b-c)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include "st_morpho_connector.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "STMicroelectronics STM32F091RC-NUCLEO board";
16	compatible = "st,stm32f091rc-nucleo";
17
18	chosen {
19		zephyr,console = &usart2;
20		zephyr,shell-uart = &usart2;
21		zephyr,sram = &sram0;
22		zephyr,flash = &flash0;
23		zephyr,canbus = &can1;
24	};
25
26	leds: leds {
27		compatible = "gpio-leds";
28		green_led_2: led_2 {
29			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
30			label = "User LD2";
31		};
32	};
33
34	gpio_keys {
35		compatible = "gpio-keys";
36		user_button: button {
37			label = "User";
38			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
39			zephyr,code = <INPUT_KEY_0>;
40		};
41	};
42
43	pwmleds: pwmleds {
44		compatible = "pwm-leds";
45		/* NOTE: disabled by default, PWM2 conflicts with SPI1 */
46		status = "disabled";
47
48		green_pwm_led: green_pwm_led {
49			pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
50		};
51	};
52
53	aliases {
54		led0 = &green_led_2;
55		sw0 = &user_button;
56		pwm-led0 = &green_pwm_led;
57		watchdog0 = &iwdg;
58		die-temp0 = &die_temp;
59		volt-sensor0 = &vref;
60		volt-sensor1 = &vbat;
61	};
62};
63
64&clk_hse {
65	hse-bypass;
66	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
67	status = "okay";
68};
69
70&clk_lsi {
71	status = "okay";
72};
73
74&pll {
75	prediv = <1>;
76	mul = <6>;
77	clocks = <&clk_hse>;
78	status = "okay";
79};
80
81&rcc {
82	clocks = <&pll>;
83	clock-frequency = <DT_FREQ_M(48)>;
84	ahb-prescaler = <1>;
85	apb1-prescaler = <1>;
86};
87
88&usart1 {
89	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
90	pinctrl-names = "default";
91	current-speed = <115200>;
92};
93
94&usart2 {
95	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
96	pinctrl-names = "default";
97	current-speed = <115200>;
98	status = "okay";
99};
100
101&i2c1 {
102	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
103	pinctrl-names = "default";
104	status = "okay";
105	clock-frequency = <I2C_BITRATE_FAST>;
106};
107
108&i2c2 {
109	/* Pin conflict with can1. Enable only with can1 disabled. */
110	pinctrl-0 = <&i2c2_scl_pa11 &i2c2_sda_pa12>;
111	pinctrl-names = "default";
112	status = "disabled";
113	clock-frequency = <I2C_BITRATE_FAST>;
114};
115
116&can1 {
117	pinctrl-0 = <&can_rx_pa11 &can_tx_pa12>;
118	pinctrl-names = "default";
119	bus-speed = <125000>;
120	status = "okay";
121};
122
123&spi1 {
124	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
125	pinctrl-names = "default";
126	status = "okay";
127};
128
129&spi2 {
130	pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
131	pinctrl-names = "default";
132	status = "okay";
133};
134
135&iwdg {
136	status = "okay";
137};
138
139&rtc {
140	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
141		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
142	status = "okay";
143};
144
145&flash0 {
146
147	partitions {
148		compatible = "fixed-partitions";
149		#address-cells = <1>;
150		#size-cells = <1>;
151
152		/* Set 6Kb of storage at the end of the 256Kb of flash */
153		storage_partition: partition@3e800 {
154			label = "storage";
155			reg = <0x0003e800 DT_SIZE_K(6)>;
156		};
157	};
158};
159
160&adc1 {
161	pinctrl-0 = <&adc_in0_pa0>;
162	pinctrl-names = "default";
163	st,adc-clock-source = <SYNC>;
164	st,adc-prescaler = <4>;
165	status = "okay";
166};
167
168&die_temp {
169	status = "okay";
170};
171
172&dac1 {
173	status = "okay";
174	pinctrl-0 = <&dac_out1_pa4>;
175	pinctrl-names = "default";
176};
177
178&dma1 {
179	status = "okay";
180};
181
182&timers2 {
183	st,prescaler = <10000>;
184	status = "okay";
185
186	pwm2: pwm {
187		/* NOTE: disabled by default, PWM2 conflicts with SPI1 */
188		pinctrl-0 = <&tim2_ch1_pa5>;
189		pinctrl-names = "default";
190	};
191};
192
193&vref {
194	status = "okay";
195};
196
197&vbat {
198	status = "okay";
199};
200