Skip to content

Commit 6995141

Browse files
committed
boards: quail: MikroBUS
this introduces the four mikroBUS™ sockets hub Signed-off-by: Oleg Kokorin <[email protected]>
1 parent 379eb7a commit 6995141

9 files changed

+366
-0
lines changed

boards/mikroe/quail/Kconfig.defconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# MikroE Quail board configuration
2+
3+
# Copyright (c) 2025 ThoseBoards
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_MIKROE_QUAIL
7+
8+
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"
9+
10+
config SPI_STM32_INTERRUPT
11+
default y
12+
depends on SPI
13+
14+
endif #BOARD_MIKROE_QUAIL
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 ThoseBoards
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_MIKROE_QUAIL
5+
select SOC_STM32F427XX

boards/mikroe/quail/board.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
4+
board_runner_args(jlink "--device=STM32F427VIT6" "--speed=4000")
5+
6+
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
7+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/mikroe/quail/board.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: mikroe_quail
3+
full_name: MikroE Quail
4+
vendor: mikroe
5+
socs:
6+
- name: stm32f427xx
94.2 KB
Loading
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.. zephyr:board:: mikroe_quail
2+
3+
Overview
4+
********
5+
MikroE Quail for STM32 is a development board containing an `STM32F427`_
6+
microcontroller. It is equipped with four mikrobus sockets.
7+
The edges of the board are lined with screw terminals and USB ports for
8+
additional connectivity.
9+
10+
Hardware
11+
********
12+
The Quail board contains the following connections:
13+
14+
- Four MikroBUS connectors
15+
- lined with 32 screw terminals and USB ports for
16+
17+
Furthermore the board contains three LEDs that are connected
18+
to the microcontroller.
19+
20+
Supported Features
21+
==================
22+
23+
.. zephyr:board-supported-hw::
24+
25+
Connections and IOs
26+
===================
27+
28+
The four mikroBUS interfaces are aliased in the device tree so that their
29+
peripherals can be accessed using ``mikrobus_N_INTERFACE`` so e.g. the spi on
30+
bus 2 can be found by the alias ``mikrobus_2_spi``. The counting corresponds
31+
with the marking on the board.
32+
33+
For connections on the edge connectors, please refer to `Quail for STM32 User Manual`_.
34+
35+
Programming and Debugging
36+
*************************
37+
Applications for the ``mikroe_quail`` board configuration can
38+
be built and flashed in the usual way (see :ref:`build_an_application` and
39+
:ref:`application_run` for more details).
40+
41+
42+
Flashing
43+
========
44+
The initial state of the board is set to lock.
45+
When you flash, it will fail with the message:
46+
47+
.. code-block:: console
48+
49+
Error: stm32x device protected
50+
51+
Unlocking with openocd makes it possible to flash.
52+
53+
.. code-block:: console
54+
55+
$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg \
56+
-f /usr/share/openocd/scripts/target/stm32f4x.cfg -c init\
57+
-c "reset halt" -c "stm32f4x unlock 0" -c "reset run" -c shutdown
58+
59+
Here is an example for the :zephyr:code-sample:`hello_world` application.
60+
61+
.. zephyr-app-commands::
62+
:zephyr-app: samples/hello_world
63+
:board: mikroe_quail
64+
:goals: build flash
65+
66+
You should see the following message on the console:
67+
68+
.. code-block:: console
69+
70+
Hello World! mikroe_quail
71+
72+
73+
Debugging
74+
=========
75+
76+
You can debug an application in the usual way. Here is an example for the
77+
:zephyr:code-sample:`hello_world` application.
78+
79+
.. zephyr-app-commands::
80+
:zephyr-app: samples/hello_world
81+
:board: mikroe_quail
82+
:maybe-skip-config:
83+
:goals: debug
84+
85+
References
86+
**********
87+
.. _Quail website:
88+
https://www.mikroe.com/quail
89+
.. _Quail for STM32 User Manual:
90+
https://download.mikroe.com/documents/starter-boards/other/quail/quail-board-manual-v100.pdf
91+
.. _STM32F427VIT6 Website:
92+
https://www.st.com/en/microcontrollers-microprocessors/stm32f427vi.html
93+
.. _STM32F427:
94+
https://www.st.com/resource/en/datasheet/stm32f427vg.pdf

boards/mikroe/quail/mikroe_quail.dts

+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
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+
ld1: led_1 {
26+
gpios = <&gpioe 15 GPIO_ACTIVE_HIGH>;
27+
label = "User LD1";
28+
};
29+
ld2: led_2 {
30+
gpios = <&gpioe 10 GPIO_ACTIVE_HIGH>;
31+
label = "User LD2";
32+
};
33+
ld3: led_3 {
34+
gpios = <&gpioc 3 GPIO_ACTIVE_HIGH>;
35+
label = "User LD3";
36+
};
37+
};
38+
39+
aliases {
40+
led0 = &ld1;
41+
led1 = &ld2;
42+
led2 = &ld3;
43+
volt-sensor0 = &vref;
44+
volt-sensor1 = &vbat;
45+
};
46+
};
47+
48+
&clk_lsi {
49+
status = "okay";
50+
};
51+
52+
&clk_hsi {
53+
clock-frequency = <DT_FREQ_M(16)>;
54+
status = "okay";
55+
};
56+
57+
&pll {
58+
div-m = <8>;
59+
mul-n = <96>;
60+
div-p = <2>;
61+
div-q = <4>;
62+
clocks = <&clk_hsi>;
63+
status = "okay";
64+
};
65+
66+
&rcc {
67+
clocks = <&pll>;
68+
clock-frequency = <DT_FREQ_M(96)>;
69+
ahb-prescaler = <1>;
70+
apb1-prescaler = <4>;
71+
apb2-prescaler = <2>;
72+
};
73+
74+
&usart1 {
75+
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
76+
pinctrl-names = "default";
77+
current-speed = <115200>;
78+
status = "okay";
79+
};
80+
81+
&usart2 {
82+
pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;
83+
pinctrl-names = "default";
84+
current-speed = <115200>;
85+
status = "okay";
86+
};
87+
88+
&usart3 {
89+
pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
90+
pinctrl-names = "default";
91+
current-speed = <115200>;
92+
status = "okay";
93+
};
94+
95+
&usart6 {
96+
pinctrl-0 = <&usart6_tx_pc6 &usart6_rx_pc7>;
97+
pinctrl-names = "default";
98+
current-speed = <115200>;
99+
status = "okay";
100+
};
101+
102+
&rtc {
103+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
104+
<&rcc STM32_SRC_LSI RTC_SEL(2)>;
105+
status = "okay";
106+
};
107+
108+
zephyr_udc0: &usbotg_fs {
109+
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
110+
pinctrl-names = "default";
111+
status = "okay";
112+
};
113+
114+
#include <../boards/common/usb/cdc_acm_serial.dtsi>
115+
116+
&spi1 {
117+
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
118+
pinctrl-names = "default";
119+
cs-gpios = <&gpioa 3 GPIO_ACTIVE_LOW>, <&gpioe 0 GPIO_ACTIVE_LOW>;
120+
status = "okay";
121+
};
122+
123+
&spi3 {
124+
status = "okay";
125+
pinctrl-0 = <&spi3_sck_pc10 &spi3_miso_pc11 &spi3_mosi_pc12>;
126+
pinctrl-names = "default";
127+
128+
cs-gpios =
129+
<&gpiod 11 GPIO_ACTIVE_LOW>, // CS0
130+
<&gpiod 1 GPIO_ACTIVE_LOW>, // CS1
131+
<&gpioa 13 GPIO_ACTIVE_LOW>; // CS2
132+
133+
//max-frequency = <100000000>; // Max frequency for the SPI bus (100 MHz in this case)
134+
//bus-width = <1>; /* 1-bit data width */
135+
};
136+
137+
/* Flash chip 1 (extra flash connected to CS2) */
138+
&spi3 {
139+
flash1: flash@2 {
140+
compatible = "jedec,spi-nor"; // Typical flash chip compatibility string
141+
reg = <2>; // The CS0 pin on the SPI bus
142+
/* S25FL164K flash's actual JEDEC: Device ID = 16h, Device Type = 40h, Capacity = 17h */
143+
//jedec-id = [16 40 17];
144+
jedec-id = [01 60 17];
145+
spi-max-frequency = <50000000>; // Max frequency for the flash chip (e.g., 50 MHz)
146+
size = <0x800000>; // Flash memory size (16MB example)
147+
page-size = <256>; // Flash page size (usually 256 or 512 bytes)
148+
//sector-size = <4096>; // Flash sector size (4KB typically)
149+
//erase-block-size = <4096>; // Erase block size (typically 4KB)
150+
//label = "flash1";
151+
status = "okay";
152+
};
153+
};
154+
155+
&i2c1 {
156+
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
157+
pinctrl-names = "default";
158+
status = "okay";
159+
};
160+
161+
&adc1 {
162+
status ="okay";
163+
pinctrl-0 = <&adc1_in4_pa4 &adc1_in5_pa5>;
164+
pinctrl-names = "default";
165+
st,adc-clock-source = "SYNC";
166+
st,adc-prescaler = <2>;
167+
};
168+
169+
&adc2 {
170+
status ="okay";
171+
pinctrl-0 = <&adc2_in6_pa6 &adc2_in7_pa7>;
172+
pinctrl-names = "default";
173+
st,adc-clock-source = "SYNC";
174+
st,adc-prescaler = <2>;
175+
};
176+
177+
&vref {
178+
status = "okay";
179+
};
180+
181+
&vbat {
182+
status = "okay";
183+
};
184+
185+
mikrobus_1_i2c: &i2c1 {};
186+
187+
mikrobus_1_spi: &spi1 {};
188+
189+
mikrobus_1_uart: &usart3 {};
190+
191+
mikrobus_2_i2c: &i2c1 {};
192+
193+
mikrobus_2_spi: &spi1 {};
194+
195+
mikrobus_2_uart: &usart2 {};
196+
197+
mikrobus_3_i2c: &i2c1 {};
198+
199+
mikrobus_3_spi: &spi3 {};
200+
201+
mikrobus_3_uart: &usart6 {};
202+
203+
mikrobus_4_i2c: &i2c1 {};
204+
205+
mikrobus_4_spi: &spi3 {};
206+
207+
mikrobus_4_uart: &usart1 {};

boards/mikroe/quail/mikroe_quail.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
identifier: mikroe_quail
2+
name: MikroE Quail for STM32
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
ram: 256
9+
flash: 2048
10+
supported:
11+
- spi
12+
- i2c
13+
- uart
14+
- adc
15+
- gpio
16+
vendor: mikroe
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Enable MPU
2+
CONFIG_ARM_MPU=y
3+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000
4+
5+
CONFIG_SERIAL=y
6+
7+
# console
8+
CONFIG_CONSOLE=y
9+
CONFIG_UART_CONSOLE=y
10+
11+
# enable GPIO
12+
CONFIG_GPIO=y
13+
14+
# enable SPI NOR FLASH
15+
CONFIG_SPI=y
16+
CONFIG_SPI_NOR=y
17+
CONFIG_FLASH=y # Enable flash subsystem

0 commit comments

Comments
 (0)