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	status = "okay";
120};
121
122&spi1 {
123	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
124	pinctrl-names = "default";
125	status = "okay";
126};
127
128&spi2 {
129	pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
130	pinctrl-names = "default";
131	status = "okay";
132};
133
134&iwdg {
135	status = "okay";
136};
137
138&rtc {
139	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
140		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
141	status = "okay";
142};
143
144&flash0 {
145
146	partitions {
147		compatible = "fixed-partitions";
148		#address-cells = <1>;
149		#size-cells = <1>;
150
151		/* Set 6Kb of storage at the end of the 256Kb of flash */
152		storage_partition: partition@3e800 {
153			label = "storage";
154			reg = <0x0003e800 DT_SIZE_K(6)>;
155		};
156	};
157};
158
159&adc1 {
160	pinctrl-0 = <&adc_in0_pa0>;
161	pinctrl-names = "default";
162	st,adc-clock-source = <SYNC>;
163	st,adc-prescaler = <4>;
164	status = "okay";
165};
166
167&die_temp {
168	status = "okay";
169};
170
171&dac1 {
172	status = "okay";
173	pinctrl-0 = <&dac_out1_pa4>;
174	pinctrl-names = "default";
175};
176
177&dma1 {
178	status = "okay";
179};
180
181&timers2 {
182	st,prescaler = <10000>;
183	status = "okay";
184
185	pwm2: pwm {
186		/* NOTE: disabled by default, PWM2 conflicts with SPI1 */
187		pinctrl-0 = <&tim2_ch1_pa5>;
188		pinctrl-names = "default";
189	};
190};
191
192&vref {
193	status = "okay";
194};
195
196&vbat {
197	status = "okay";
198};
199