1/*
2 * Copyright (c) 2017 I-SENSE group of ICCS
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f3/stm32f303Xc.dtsi>
9#include <st/f3/stm32f303v(b-c)tx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics STM32F3DISCOVERY board";
14	compatible = "st,stm32f3discovery";
15
16	chosen {
17		zephyr,console = &usart1;
18		zephyr,shell-uart = &usart1;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,canbus = &can1;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		red_led_3: led_3 {
27			gpios = <&gpioe 9 GPIO_ACTIVE_HIGH>;
28			label = "User LD3";
29		};
30		blue_led_4: led_4 {
31			gpios = <&gpioe 8 GPIO_ACTIVE_HIGH>;
32			label = "User LD4";
33		};
34		orange_led_5: led_5 {
35			gpios = <&gpioe 10 GPIO_ACTIVE_HIGH>;
36			label = "User LD5";
37		};
38		green_led_6: led_6 {
39			gpios = <&gpioe 15 GPIO_ACTIVE_HIGH>;
40			label = "User LD6";
41		};
42		green_led_7: led_7 {
43			gpios = <&gpioe 11 GPIO_ACTIVE_HIGH>;
44			label = "User LD7";
45		};
46		orange_led_8: led_8 {
47			gpios = <&gpioe 14 GPIO_ACTIVE_HIGH>;
48			label = "User LD8";
49		};
50		blue_led_9: led_9 {
51			gpios = <&gpioe 12 GPIO_ACTIVE_HIGH>;
52			label = "User LD9";
53		};
54		red_led_10: led_10 {
55			gpios = <&gpioe 13 GPIO_ACTIVE_HIGH>;
56			label = "User LD10";
57		};
58	};
59
60	gpio_keys {
61		compatible = "gpio-keys";
62		user_button: button {
63			label = "User";
64			gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
65			zephyr,code = <INPUT_KEY_0>;
66		};
67	};
68
69	aliases {
70		led0 = &green_led_6;
71		led1 = &green_led_7;
72		sw0 = &user_button;
73		magn0 = &lsm303dlhc_magn;
74		watchdog0 = &iwdg;
75		accel0 = &lsm303dlhc_accel;
76		die-temp0 = &die_temp;
77		volt-sensor0 = &vref;
78		volt-sensor1 = &vbat;
79	};
80};
81
82&clk_lsi {
83	status = "okay";
84};
85
86&clk_hse {
87	hse-bypass;
88	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
89	status = "okay";
90};
91
92&pll {
93	prediv = <1>;
94	mul = <9>;
95	clocks = <&clk_hse>;
96	status = "okay";
97};
98
99&rcc {
100	clocks = <&pll>;
101	clock-frequency = <DT_FREQ_M(72)>;
102	ahb-prescaler = <1>;
103	apb1-prescaler = <2>;
104	apb2-prescaler = <1>;
105};
106
107&usart1 {
108	pinctrl-0 = <&usart1_tx_pc4 &usart1_rx_pc5>;
109	pinctrl-names = "default";
110	current-speed = <115200>;
111	status = "okay";
112};
113
114&usart2 {
115	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
116	pinctrl-names = "default";
117	current-speed = <115200>;
118	status = "okay";
119};
120
121&uart4 {
122	pinctrl-0 = <&uart4_tx_pc10 &uart4_rx_pc11>;
123	pinctrl-names = "default";
124	current-speed = <115200>;
125	status = "okay";
126};
127
128&i2c1 {
129	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
130	pinctrl-names = "default";
131	status = "okay";
132	clock-frequency = <I2C_BITRATE_FAST>;
133
134	lsm303dlhc_magn: lsm303dlhc-magn@1e {
135		compatible = "st,lsm303dlhc-magn";
136		reg = <0x1e>;
137	};
138
139	lsm303dlhc_accel: lsm303dlhc-accel@19 {
140		compatible = "st,lis2dh", "st,lsm303dlhc-accel";
141		reg = <0x19>;
142		irq-gpios = <&gpioe 4 GPIO_ACTIVE_HIGH>,
143			  <&gpioe 5 GPIO_ACTIVE_HIGH>;
144	};
145};
146
147&i2c2 {
148	pinctrl-0 = <&i2c2_scl_pa9 &i2c2_sda_pa10>;
149	pinctrl-names = "default";
150	status = "okay";
151	clock-frequency = <I2C_BITRATE_FAST>;
152};
153
154&spi1 {
155	pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5
156		     &spi1_miso_pa6 &spi1_mosi_pa7>;
157	pinctrl-names = "default";
158	status = "okay";
159};
160
161&spi2 {
162	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
163		     &spi2_miso_pb14 &spi2_mosi_pb15>;
164	pinctrl-names = "default";
165	status = "okay";
166};
167
168zephyr_udc0: &usb {
169	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
170	pinctrl-names = "default";
171	status = "okay";
172};
173
174&rtc {
175	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
176		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
177	status = "okay";
178
179	backup_regs {
180		status = "okay";
181	};
182};
183
184&can1 {
185	pinctrl-0 = <&can_rx_pd0 &can_tx_pd1>;
186	pinctrl-names = "default";
187	status = "okay";
188	bus-speed = <125000>;
189};
190
191&flash0 {
192
193	partitions {
194		compatible = "fixed-partitions";
195		#address-cells = <1>;
196		#size-cells = <1>;
197
198		/* Set 6Kb of storage at the end of the 256Kb of flash */
199		storage_partition: partition@3e800 {
200			label = "storage";
201			reg = <0x0003e800 DT_SIZE_K(6)>;
202		};
203	};
204};
205
206&iwdg {
207	status = "okay";
208};
209
210&timers1 {
211	st,prescaler = <10000>;
212	status = "okay";
213	pwm1: pwm {
214		status = "okay";
215		pinctrl-0 = <&tim1_ch1_pa8>;
216		pinctrl-names = "default";
217	};
218};
219
220&adc1 {
221	pinctrl-0 = <&adc1_in1_pa0>;
222	pinctrl-names = "default";
223	st,adc-clock-source = <SYNC>;
224	st,adc-prescaler = <2>;
225	status = "okay";
226};
227
228&die_temp {
229	status = "okay";
230};
231
232&dac1 {
233	status = "okay";
234	/* dac output pins(pa4,pa5,pa6) might conflict with spi1 pins */
235	pinctrl-0 = <&dac_out1_pa4>;
236	pinctrl-names = "default";
237};
238
239&dma1 {
240	status = "okay";
241};
242
243&vref {
244	status = "okay";
245};
246
247&vbat {
248	status = "okay";
249};
250