diff --git a/boards/mikroe/quail/Kconfig.defconfig b/boards/mikroe/quail/Kconfig.defconfig new file mode 100644 index 000000000000..ea45af09da97 --- /dev/null +++ b/boards/mikroe/quail/Kconfig.defconfig @@ -0,0 +1,10 @@ +# MikroE Quail board configuration + +# Copyright (c) 2025 ThoseBoards +# SPDX-License-Identifier: Apache-2.0 + +source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig" + +config SPI_STM32_INTERRUPT + default y + depends on SPI diff --git a/boards/mikroe/quail/Kconfig.mikroe_quail b/boards/mikroe/quail/Kconfig.mikroe_quail new file mode 100644 index 000000000000..f711abe5738e --- /dev/null +++ b/boards/mikroe/quail/Kconfig.mikroe_quail @@ -0,0 +1,5 @@ +# Copyright (c) 2025 ThoseBoards +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MIKROE_QUAIL + select SOC_STM32F427XX diff --git a/boards/mikroe/quail/board.cmake b/boards/mikroe/quail/board.cmake new file mode 100644 index 000000000000..7718f87e84a9 --- /dev/null +++ b/boards/mikroe/quail/board.cmake @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") +board_runner_args(jlink "--device=STM32F427VIT6" "--speed=4000") + +include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/mikroe/quail/board.yml b/boards/mikroe/quail/board.yml new file mode 100644 index 000000000000..b363f83059c7 --- /dev/null +++ b/boards/mikroe/quail/board.yml @@ -0,0 +1,6 @@ +board: + name: mikroe_quail + full_name: MikroE Quail + vendor: mikroe + socs: + - name: stm32f427xx diff --git a/boards/mikroe/quail/doc/img/mikroe_quail.webp b/boards/mikroe/quail/doc/img/mikroe_quail.webp new file mode 100644 index 000000000000..801b29d3a485 Binary files /dev/null and b/boards/mikroe/quail/doc/img/mikroe_quail.webp differ diff --git a/boards/mikroe/quail/doc/mikroe_quail.rst b/boards/mikroe/quail/doc/mikroe_quail.rst new file mode 100644 index 000000000000..66fbb7619828 --- /dev/null +++ b/boards/mikroe/quail/doc/mikroe_quail.rst @@ -0,0 +1,99 @@ +.. zephyr:board:: mikroe_quail + +Overview +******** +MikroE Quail for STM32 is a development board containing an `STM32F427`_ +microcontroller. It is equipped with four mikrobus sockets. +The edges of the board are lined with screw terminals and USB ports for +additional connectivity. + +Hardware +******** +The Quail board contains the following connections: + + - Four MikroBUS connectors + - lined with 32 screw terminals and USB ports for + +Furthermore the board contains three LEDs that are connected +to the microcontroller. + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Connections and IOs +=================== + +The four mikroBUS interfaces are aliased in the device tree so that their +peripherals can be accessed using ``mikrobus_N_INTERFACE`` so e.g. the spi on +bus 2 can be found by the alias ``mikrobus_2_spi``. The counting corresponds +with the marking on the board. + +For connections on the edge connectors, please refer to `Quail for STM32 User Manual`_. + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +Applications for the ``mikroe_quail`` board can be built and flashed in the usual way +(see :ref:`build_an_application` and :ref:`application_run` for more details). + + +Flashing +======== +The initial state of the board is set to lock. +When you flash, it will fail with the message: + +.. code-block:: console + + Error: stm32x device protected + +Unlocking with openocd makes it possible to flash. + +.. code-block:: console + + $ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg \ + -f /usr/share/openocd/scripts/target/stm32f4x.cfg -c init\ + -c "reset halt" -c "stm32f4x unlock 0" -c "reset run" -c shutdown + +Here is an example for the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: mikroe_quail + :goals: build flash + +You should see the following message on the console: + +.. code-block:: console + + Hello World! mikroe_quail + + +Debugging +========= + +You can debug an application in the usual way. Here is an example for the +:zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: mikroe_quail + :maybe-skip-config: + :goals: debug + +References +********** + +.. target-notes:: + +.. _Quail website: + https://www.mikroe.com/quail +.. _Quail for STM32 User Manual: + https://download.mikroe.com/documents/starter-boards/other/quail/quail-board-manual-v100.pdf +.. _STM32F427VIT6 Website: + https://www.st.com/en/microcontrollers-microprocessors/stm32f427vi.html +.. _STM32F427: + https://www.st.com/resource/en/datasheet/stm32f427vg.pdf diff --git a/boards/mikroe/quail/mikroe_quail.dts b/boards/mikroe/quail/mikroe_quail.dts new file mode 100644 index 000000000000..96666d430339 --- /dev/null +++ b/boards/mikroe/quail/mikroe_quail.dts @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2025 ThoseBoards + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include + +/ { + model = "MikroE Quail for STM32"; + compatible = "mikroe,stm32-e427", "st,stm32f427"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,flash-controller = &flash1; + zephyr,ccm = &ccm0; + }; + + leds { + compatible = "gpio-leds"; + + ld1: led_1 { + gpios = <&gpioe 15 GPIO_ACTIVE_HIGH>; + label = "User LD1"; + }; + + ld2: led_2 { + gpios = <&gpioe 10 GPIO_ACTIVE_HIGH>; + label = "User LD2"; + }; + + ld3: led_3 { + gpios = <&gpioc 3 GPIO_ACTIVE_HIGH>; + label = "User LD3"; + }; + }; + + zephyr,user { + io-channels = <&adc1 0>, <&adc1 1>, <&adc2 0>, <&adc2 1>; + }; + + aliases { + led0 = &ld1; + led1 = &ld2; + led2 = &ld3; + volt-sensor0 = &vref; + volt-sensor1 = &vbat; + }; + + skd1: socket_1_adc { + status = "okay"; + io-channels = <&adc2 0>; + }; + + skd2: socket_2_adc { + status = "okay"; + io-channels = <&adc1 0>; + }; + + skd3: socket_3_adc { + status = "okay"; + io-channels = <&adc2 1>; + }; + + skd4: socket_4_adc { + status = "okay"; + io-channels = <&adc1 1>; + }; +}; + +&clk_lsi { + status = "okay"; +}; + +&clk_hsi { + clock-frequency = ; + status = "okay"; +}; + +&pll { + div-m = <8>; + mul-n = <96>; + div-p = <2>; + div-q = <4>; + clocks = <&clk_hsi>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <4>; + apb2-prescaler = <2>; +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&usart2 { + pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&usart3 { + pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&usart6 { + pinctrl-0 = <&usart6_tx_pc6 &usart6_rx_pc7>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&rtc { + clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>, + <&rcc STM32_SRC_LSI RTC_SEL(2)>; + status = "okay"; +}; + +zephyr_udc0: &usbotg_fs { + pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +#include <../boards/common/usb/cdc_acm_serial.dtsi> + +&spi1 { + pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>; + pinctrl-names = "default"; + cs-gpios = <&gpioa 3 GPIO_ACTIVE_LOW>, <&gpioe 0 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + +&spi3 { + status = "okay"; + pinctrl-0 = <&spi3_sck_pc10 &spi3_miso_pc11 &spi3_mosi_pc12>; + pinctrl-names = "default"; + + cs-gpios = + <&gpiod 11 GPIO_ACTIVE_LOW>, // CS0 + <&gpiod 1 GPIO_ACTIVE_LOW>, // CS1 + <&gpioa 13 GPIO_ACTIVE_LOW>; // CS2 +}; + +/* Flash chip 1 (extra flash connected to CS2) */ +&spi3 { + flash1: flash@2 { + compatible = "jedec,spi-nor"; // Typical flash chip compatibility string + reg = <2>; // The CS0 pin on the SPI bus + // S25FL164K flash's actual JEDEC: Device ID = 16h, Device Type = 40h, + // Capacity = 17h + //jedec-id = [16 40 17]; + jedec-id = [01 60 17]; + spi-max-frequency = <50000000>; // Max frequency for the flash chip (e.g., 50 MHz) + size = <0x800000>; // Flash memory size (16MB example) + page-size = <256>; // Flash page size (usually 256 or 512 bytes) + //sector-size = <4096>; // Flash sector size (4KB typically) + //erase-block-size = <4096>; // Erase block size (typically 4KB) + //label = "flash1"; + status = "okay"; + }; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; + pinctrl-names = "default"; + status = "okay"; +}; + +&adc1 { + status ="okay"; + pinctrl-0 = <&adc1_in4_pa4 &adc1_in5_pa5>; + pinctrl-names = "default"; + st,adc-clock-source = "SYNC"; + st,adc-prescaler = <2>; +}; + +&adc2 { + status ="okay"; + pinctrl-0 = <&adc2_in6_pa6 &adc2_in7_pa7>; + pinctrl-names = "default"; + st,adc-clock-source = "SYNC"; + st,adc-prescaler = <2>; +}; + +&vref { + status = "okay"; +}; + +&vbat { + status = "okay"; +}; + +mikrobus_1_adc: &skd1 {}; + +mikrobus_1_i2c: &i2c1 {}; + +mikrobus_1_spi: &spi1 {}; + +mikrobus_1_uart: &usart3 {}; + +mikrobus_2_adc: &skd2 {}; + +mikrobus_2_i2c: &i2c1 {}; + +mikrobus_2_spi: &spi1 {}; + +mikrobus_2_uart: &usart2 {}; + +mikrobus_3_adc: &skd3 {}; + +mikrobus_3_i2c: &i2c1 {}; + +mikrobus_3_spi: &spi3 {}; + +mikrobus_3_uart: &usart6 {}; + +mikrobus_4_adc: &skd4 {}; + +mikrobus_4_i2c: &i2c1 {}; + +mikrobus_4_spi: &spi3 {}; + +mikrobus_4_uart: &usart1 {}; diff --git a/boards/mikroe/quail/mikroe_quail.yaml b/boards/mikroe/quail/mikroe_quail.yaml new file mode 100644 index 000000000000..f114861f6bc7 --- /dev/null +++ b/boards/mikroe/quail/mikroe_quail.yaml @@ -0,0 +1,17 @@ +identifier: mikroe_quail +name: MikroE Quail for STM32 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +ram: 256 +flash: 2048 +supported: + - spi + - i2c + - uart + - adc + - gpio + - flash +vendor: mikroe diff --git a/boards/mikroe/quail/mikroe_quail_defconfig b/boards/mikroe/quail/mikroe_quail_defconfig new file mode 100644 index 000000000000..e5819cf79508 --- /dev/null +++ b/boards/mikroe/quail/mikroe_quail_defconfig @@ -0,0 +1,11 @@ +# Enable MPU +CONFIG_ARM_MPU=y + +CONFIG_SERIAL=y + +# Console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y