1/* 2 * Copyright (c) 2025 ThoseBoards 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/dts-v1/; 8#include <st/f4/stm32f427vi.dtsi> 9#include <st/f4/stm32f427v(g-i)tx-pinctrl.dtsi> 10#include <zephyr/dt-bindings/input/input-event-codes.h> 11 12/ { 13 model = "MikroE Quail for STM32"; 14 compatible = "mikroe,stm32-e427", "st,stm32f427"; 15 16 chosen { 17 zephyr,sram = &sram0; 18 zephyr,flash = &flash0; 19 zephyr,flash-controller = &flash1; 20 zephyr,ccm = &ccm0; 21 }; 22 23 leds { 24 compatible = "gpio-leds"; 25 26 ld1: led_1 { 27 gpios = <&gpioe 15 GPIO_ACTIVE_HIGH>; 28 label = "User LD1"; 29 }; 30 31 ld2: led_2 { 32 gpios = <&gpioe 10 GPIO_ACTIVE_HIGH>; 33 label = "User LD2"; 34 }; 35 36 ld3: led_3 { 37 gpios = <&gpioc 3 GPIO_ACTIVE_HIGH>; 38 label = "User LD3"; 39 }; 40 }; 41 42 zephyr,user { 43 io-channels = <&adc1 0>, <&adc1 1>, <&adc2 0>, <&adc2 1>; 44 }; 45 46 mikrobus_1_header: mikrobus-connector-1 { 47 compatible = "mikro-bus"; 48 #gpio-cells = <2>; 49 gpio-map-mask = <0xffffffff 0xffffffc0>; 50 gpio-map-pass-thru = <0 0x3f>; 51 gpio-map = <0 0 &gpioa 6 0>, /* AN */ 52 <1 0 &gpioa 2 0>, /* RST */ 53 <2 0 &gpioa 3 0>, /* CS */ 54 <3 0 &gpiob 3 0>, /* SCK */ 55 <4 0 &gpiob 4 0>, /* MISO */ 56 <5 0 &gpiob 5 0>, /* MOSI */ 57 /* +3.3V */ 58 /* GND */ 59 <6 0 &gpioe 9 0>, /* PWM */ 60 <7 0 &gpioa 1 0>, /* INT */ 61 <8 0 &gpiod 9 0>, /* RX */ 62 <9 0 &gpiod 8 0>, /* TX */ 63 <10 0 &gpiob 6 0>, /* SCL */ 64 <11 0 &gpiob 7 0>; /* SDA */ 65 /* +5V */ 66 /* GND */ 67 }; 68 69 mikrobus_2_header: mikrobus-connector-2 { 70 compatible = "mikro-bus"; 71 #gpio-cells = <2>; 72 gpio-map-mask = <0xffffffff 0xffffffc0>; 73 gpio-map-pass-thru = <0 0x3f>; 74 gpio-map = <0 0 &gpioa 4 0>, /* AN */ 75 <1 0 &gpioe 1 0>, /* RST */ 76 <2 0 &gpioe 0 0>, /* CS */ 77 <3 0 &gpiob 3 0>, /* SCK */ 78 <4 0 &gpiob 4 0>, /* MISO */ 79 <5 0 &gpiob 5 0>, /* MOSI */ 80 /* +3.3V */ 81 /* GND */ 82 <6 0 &gpiod 15 0>, /* PWM */ 83 <7 0 &gpiob 9 0>, /* INT */ 84 <8 0 &gpiod 6 0>, /* RX */ 85 <9 0 &gpiod 5 0>, /* TX */ 86 <10 0 &gpiob 6 0>, /* SCL */ 87 <11 0 &gpiob 7 0>; /* SDA */ 88 /* +5V */ 89 /* GND */ 90 }; 91 92 mikrobus_3_header: mikrobus-connector-3 { 93 compatible = "mikro-bus"; 94 #gpio-cells = <2>; 95 gpio-map-mask = <0xffffffff 0xffffffc0>; 96 gpio-map-pass-thru = <0 0x3f>; 97 gpio-map = <0 0 &gpioa 7 0>, /* AN */ 98 <1 0 &gpiod 8 0>, /* RST */ 99 <2 0 &gpiod 11 0>, /* CS */ 100 <3 0 &gpioc 10 0>, /* SCK */ 101 <4 0 &gpioc 11 0>, /* MISO */ 102 <5 0 &gpioc 12 0>, /* MOSI */ 103 /* +3.3V */ 104 /* GND */ 105 <6 0 &gpiod 13 0>, /* PWM */ 106 <7 0 &gpioc 8 0>, /* INT */ 107 <8 0 &gpioc 7 0>, /* RX */ 108 <9 0 &gpioc 6 0>, /* TX */ 109 <10 0 &gpiob 6 0>, /* SCL */ 110 <11 0 &gpiob 7 0>; /* SDA */ 111 /* +5V */ 112 /* GND */ 113 }; 114 115 mikrobus_4_header: mikrobus-connector-4 { 116 compatible = "mikro-bus"; 117 #gpio-cells = <2>; 118 gpio-map-mask = <0xffffffff 0xffffffc0>; 119 gpio-map-pass-thru = <0 0x3f>; 120 gpio-map = <0 0 &gpioa 5 0>, /* AN */ 121 <1 0 &gpiod 0 0>, /* RST */ 122 <2 0 &gpiod 1 0>, /* CS */ 123 <3 0 &gpioc 10 0>, /* SCK */ 124 <4 0 &gpioc 11 0>, /* MISO */ 125 <5 0 &gpioc 12 0>, /* MOSI */ 126 /* +3.3V */ 127 /* GND */ 128 <6 0 &gpiod 14 0>, /* PWM */ 129 <7 0 &gpioa 14 0>, /* INT */ 130 <8 0 &gpioa 10 0>, /* RX */ 131 <9 0 &gpioa 9 0>, /* TX */ 132 <10 0 &gpiob 6 0>, /* SCL */ 133 <11 0 &gpiob 7 0>; /* SDA */ 134 /* +5V */ 135 /* GND */ 136 }; 137 138 edge_header: connector { 139 #gpio-cells = <2>; 140 gpio-map-mask = <0xffffffff 0xffffffc0>; 141 gpio-map-pass-thru = <0 0x3f>; 142 gpio-map = <0 0 &gpioc 5 0>, /* ,PC5 */ 143 <1 0 &gpiob 0 0>, /* ,PB0 */ 144 <2 0 &gpioe 7 0>, /* ,PE7 */ 145 <3 0 &gpioe 8 0>, /* ,PE8 */ 146 <4 0 &gpioe 11 0>, /* ,PE11 */ 147 <5 0 &gpioc 4 0>, /* ,PC4 */ 148 <6 0 &gpioe 13 0>, /* ,PE13 */ 149 <7 0 &gpioe 14 0>, /* ,PE14 */ 150 <8 0 &gpiob 10 0>, /* ,PB10 */ 151 <9 0 &gpiob 11 0>, /* ,PB11 */ 152 <10 0 &gpiob 12 0>, /* ,PB12 */ 153 <11 0 &gpiob 13 0>, /* ,PB13 */ 154 <12 0 &gpiob 6 0>, /* ,PB6 # I2C1 */ 155 <13 0 &gpiob 7 0>, /* ,PB7 # I2C1 */ 156 <14 0 &gpioc 10 0>, /* ,PC10 # SPI3 */ 157 <15 0 &gpioc 11 0>, /* ,PC11 # SPI3 */ 158 <16 0 &gpioc 12 0>, /* ,PC12 # SPI3 */ 159 <17 0 &gpiod 10 0>, /* ,PD10 # SPI3 */ 160 <18 0 &gpioa 15 0>, /* ,PA15 */ 161 <19 0 &gpioc 13 0>, /* ,PC13 */ 162 <20 0 &gpioe 6 0>, /* ,PE6 */ 163 <21 0 &gpioe 5 0>, /* ,PE5 */ 164 <22 0 &gpiod 2 0>, /* ,PD2 */ 165 <23 0 &gpiod 3 0>, /* ,PD3 */ 166 <24 0 &gpiod 4 0>, /* ,PD4 */ 167 <25 0 &gpiod 7 0>, /* ,PD7 */ 168 <26 0 &gpioe 2 0>, /* ,PE2 */ 169 <27 0 &gpioe 3 0>, /* ,PE3 */ 170 <28 0 &gpioe 4 0>; /* ,PE4 */ 171 }; 172 173 aliases { 174 led0 = &ld1; 175 led1 = &ld2; 176 led2 = &ld3; 177 volt-sensor0 = &vref; 178 volt-sensor1 = &vbat; 179 }; 180 181 skd1: socket_1_adc { 182 status = "okay"; 183 io-channels = <&adc2 0>; 184 }; 185 186 skd2: socket_2_adc { 187 status = "okay"; 188 io-channels = <&adc1 0>; 189 }; 190 191 skd3: socket_3_adc { 192 status = "okay"; 193 io-channels = <&adc2 1>; 194 }; 195 196 skd4: socket_4_adc { 197 status = "okay"; 198 io-channels = <&adc1 1>; 199 }; 200}; 201 202&clk_lsi { 203 status = "okay"; 204}; 205 206&clk_hsi { 207 clock-frequency = <DT_FREQ_M(16)>; 208 status = "okay"; 209}; 210 211&pll { 212 div-m = <8>; 213 mul-n = <96>; 214 div-p = <2>; 215 div-q = <4>; 216 clocks = <&clk_hsi>; 217 status = "okay"; 218}; 219 220&rcc { 221 clocks = <&pll>; 222 clock-frequency = <DT_FREQ_M(96)>; 223 ahb-prescaler = <1>; 224 apb1-prescaler = <4>; 225 apb2-prescaler = <2>; 226}; 227 228&usart1 { 229 pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; 230 pinctrl-names = "default"; 231 current-speed = <115200>; 232 status = "okay"; 233}; 234 235&usart2 { 236 pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>; 237 pinctrl-names = "default"; 238 current-speed = <115200>; 239 status = "okay"; 240}; 241 242&usart3 { 243 pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>; 244 pinctrl-names = "default"; 245 current-speed = <115200>; 246 status = "okay"; 247}; 248 249&usart6 { 250 pinctrl-0 = <&usart6_tx_pc6 &usart6_rx_pc7>; 251 pinctrl-names = "default"; 252 current-speed = <115200>; 253 status = "okay"; 254}; 255 256&rtc { 257 clocks = <&rcc STM32_CLOCK(APB1, 28)>, 258 <&rcc STM32_SRC_LSI RTC_SEL(2)>; 259 status = "okay"; 260}; 261 262zephyr_udc0: &usbotg_fs { 263 pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>; 264 pinctrl-names = "default"; 265 status = "okay"; 266}; 267 268#include <../boards/common/usb/cdc_acm_serial.dtsi> 269 270&spi1 { 271 pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>; 272 pinctrl-names = "default"; 273 cs-gpios = <&gpioa 3 GPIO_ACTIVE_LOW>, <&gpioe 0 GPIO_ACTIVE_LOW>; 274 status = "okay"; 275}; 276 277&spi3 { 278 status = "okay"; 279 pinctrl-0 = <&spi3_sck_pc10 &spi3_miso_pc11 &spi3_mosi_pc12>; 280 pinctrl-names = "default"; 281 282 cs-gpios = 283 <&gpiod 11 GPIO_ACTIVE_LOW>, // CS0 284 <&gpiod 1 GPIO_ACTIVE_LOW>, // CS1 285 <&gpioa 13 GPIO_ACTIVE_LOW>; // CS2 286}; 287 288/* Flash chip 1 (extra flash connected to CS2) */ 289&spi3 { 290 flash1: flash@2 { 291 compatible = "jedec,spi-nor"; // Typical flash chip compatibility string 292 reg = <2>; // The CS0 pin on the SPI bus 293 // S25FL164K flash's actual JEDEC: Device ID = 16h, Device Type = 40h, 294 // Capacity = 17h 295 //jedec-id = [16 40 17]; 296 jedec-id = [01 60 17]; 297 spi-max-frequency = <50000000>; // Max frequency for the flash chip (e.g., 50 MHz) 298 size = <0x800000>; // Flash memory size (16MB example) 299 page-size = <256>; // Flash page size (usually 256 or 512 bytes) 300 status = "okay"; 301 }; 302}; 303 304&i2c1 { 305 pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; 306 pinctrl-names = "default"; 307 status = "okay"; 308}; 309 310&adc1 { 311 status ="okay"; 312 pinctrl-0 = <&adc1_in4_pa4 &adc1_in5_pa5>; 313 pinctrl-names = "default"; 314 st,adc-clock-source = "SYNC"; 315 st,adc-prescaler = <2>; 316}; 317 318&adc2 { 319 status ="okay"; 320 pinctrl-0 = <&adc2_in6_pa6 &adc2_in7_pa7>; 321 pinctrl-names = "default"; 322 st,adc-clock-source = "SYNC"; 323 st,adc-prescaler = <2>; 324}; 325 326&vref { 327 status = "okay"; 328}; 329 330&vbat { 331 status = "okay"; 332}; 333 334mikrobus_1_adc: &skd1 {}; 335 336mikrobus_1_i2c: &i2c1 {}; 337 338mikrobus_1_spi: &spi1 {}; 339 340mikrobus_1_uart: &usart3 {}; 341 342mikrobus_2_adc: &skd2 {}; 343 344mikrobus_2_i2c: &i2c1 {}; 345 346mikrobus_2_spi: &spi1 {}; 347 348mikrobus_2_uart: &usart2 {}; 349 350mikrobus_3_adc: &skd3 {}; 351 352mikrobus_3_i2c: &i2c1 {}; 353 354mikrobus_3_spi: &spi3 {}; 355 356mikrobus_3_uart: &usart6 {}; 357 358mikrobus_4_adc: &skd4 {}; 359 360mikrobus_4_i2c: &i2c1 {}; 361 362mikrobus_4_spi: &spi3 {}; 363 364mikrobus_4_uart: &usart1 {}; 365 366mikrobus_adc: &skd1 {}; 367 368mikrobus_i2c: &i2c1 {}; 369 370mikrobus_spi: &spi1 {}; 371 372mikrobus_uart: &usart3 {}; 373 374mikrobus_header: &mikrobus_1_header {}; 375