Skip to content

boards: quail: MikroBUS #89364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions boards/mikroe/quail/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# MikroE Quail board configuration

# Copyright (c) 2025 ThoseBoards
# SPDX-License-Identifier: Apache-2.0

source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

config SYS_CLOCK_HW_CYCLES_PER_SEC
default $(dt_node_int_prop_int,/soc/rcc@40023800,clock-frequency)
Comment on lines +8 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this value is OK but should be in a SoC Kconfig file (unless the board has a different clock source overriding it), @erwango can this be applied at soc level?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like to propose to you to make this change as a separate CR/MR/PR, as it will definitely impact the whole stm32f4 family of the boards


config SPI_STM32_INTERRUPT
default y
depends on SPI
5 changes: 5 additions & 0 deletions boards/mikroe/quail/Kconfig.mikroe_quail
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2025 ThoseBoards
# SPDX-License-Identifier: Apache-2.0

config BOARD_MIKROE_QUAIL
select SOC_STM32F427XX
7 changes: 7 additions & 0 deletions boards/mikroe/quail/board.cmake
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions boards/mikroe/quail/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: mikroe_quail
full_name: MikroE Quail
vendor: mikroe
socs:
- name: stm32f427xx
Binary file added boards/mikroe/quail/doc/img/mikroe_quail.webp
Binary file not shown.
99 changes: 99 additions & 0 deletions boards/mikroe/quail/doc/mikroe_quail.rst
Original file line number Diff line number Diff line change
@@ -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
240 changes: 240 additions & 0 deletions boards/mikroe/quail/mikroe_quail.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
/*
* Copyright (c) 2025 ThoseBoards
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <st/f4/stm32f427vi.dtsi>
#include <st/f4/stm32f427v(g-i)tx-pinctrl.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
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 = <DT_FREQ_M(16)>;
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 = <DT_FREQ_M(96)>;
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 {};
17 changes: 17 additions & 0 deletions boards/mikroe/quail/mikroe_quail.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading