1/*
2 * Copyright (c) 2017 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f1/stm32f103Xb.dtsi>
9#include <st/f1/stm32f103r(8-b)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 STM32F103RB-NUCLEO board";
16	compatible = "st,stm32f103rb-nucleo";
17
18	chosen {
19		zephyr,console = &usart2;
20		zephyr,shell-uart = &usart2;
21		zephyr,sram = &sram0;
22		zephyr,flash = &flash0;
23	};
24
25	leds: leds {
26		compatible = "gpio-leds";
27		green_led_2: led_2 {
28			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
29			label = "User LD2";
30		};
31	};
32
33	gpio_keys {
34		compatible = "gpio-keys";
35		user_button: button {
36			label = "User";
37			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
38			zephyr,code = <INPUT_KEY_0>;
39		};
40	};
41
42	aliases {
43		led0 = &green_led_2;
44		sw0 = &user_button;
45		watchdog0 = &iwdg;
46		die-temp0 = &die_temp;
47	};
48};
49
50&clk_lsi {
51	status = "okay";
52};
53
54&clk_hse {
55	hse-bypass;
56	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
57	status = "okay";
58};
59
60&pll {
61	mul = <9>;
62	clocks = <&clk_hse>;
63	status = "okay";
64};
65
66&rcc {
67	clocks = <&pll>;
68	clock-frequency = <DT_FREQ_M(72)>;
69	ahb-prescaler = <1>;
70	apb1-prescaler = <2>;
71	apb2-prescaler = <1>;
72	adc-prescaler = <2>;
73};
74
75&usart1 {
76	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
77	pinctrl-names = "default";
78	current-speed = <115200>;
79	status = "okay";
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&usart3 {
90	pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>;
91	pinctrl-names = "default";
92	current-speed = <115200>;
93};
94
95&i2c1 {
96	pinctrl-0 = <&i2c1_scl_remap1_pb8 &i2c1_sda_remap1_pb9>;
97	pinctrl-names = "default";
98	status = "okay";
99	clock-frequency = <I2C_BITRATE_FAST>;
100};
101
102&spi1 {
103	pinctrl-0 = <&spi1_sck_master_pa5 &spi1_miso_master_pa6 &spi1_mosi_master_pa7>;
104	pinctrl-names = "default";
105	cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
106	status = "okay";
107};
108
109&spi2 {
110	pinctrl-0 = <&spi2_nss_master_pb12 &spi2_sck_master_pb13
111		     &spi2_miso_master_pb14 &spi2_mosi_master_pb15>;
112	pinctrl-names = "default";
113	status = "okay";
114};
115
116&timers1 {
117	st,prescaler = <10000>;
118	status = "okay";
119
120	pwm1: pwm {
121		status = "okay";
122		pinctrl-0 = <&tim1_ch1_pwm_out_pa8>;
123		pinctrl-names = "default";
124	};
125};
126
127&timers2 {
128	st,prescaler = <255>;
129	status = "okay";
130
131	pwm2: pwm {
132		status = "okay";
133		pinctrl-0 = <&tim2_ch2_pwm_in_pa1>;
134		pinctrl-names = "default";
135	};
136};
137
138&iwdg {
139	status = "okay";
140};
141
142&rtc {
143	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
144		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
145	status = "okay";
146};
147
148&adc1 {
149	pinctrl-0 = <&adc1_in0_pa0>;
150	pinctrl-names = "default";
151	status = "okay";
152};
153
154&die_temp {
155	status = "okay";
156};
157
158&dma1 {
159	status = "okay";
160};
161
162&flash0 {
163	partitions {
164		compatible = "fixed-partitions";
165		#address-cells = <1>;
166		#size-cells = <1>;
167
168		/* Set 2KB of storage at the end of 128KB flash */
169		storage_partition: partition@1f800 {
170			label = "storage";
171			reg = <0x0001f800 DT_SIZE_K(2)>;
172		};
173	};
174};
175