Skip to content

Commit 9f50de1

Browse files
iandmorrisnashif
authored andcommitted
boards: mikroe: add initial support for Mikroe STM32 M4 Clicker
The STM32 M4 Clicker is a basic development board for the ST STM32F415RG Microcontroller. The board contains two LEDs and push buttons and several headers for interfacing with external devices. Signed-off-by: Ian Morris <[email protected]>
1 parent 494133a commit 9f50de1

File tree

9 files changed

+314
-0
lines changed

9 files changed

+314
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2024 Ian Morris
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_MIKROE_STM32_M4_CLICKER
5+
6+
if USB_DEVICE_STACK
7+
8+
config UART_CONSOLE
9+
default CONSOLE
10+
11+
config USB_DEVICE_INITIALIZE_AT_BOOT
12+
default y
13+
14+
endif # USB_DEVICE_STACK
15+
16+
if LOG
17+
18+
# Logger cannot use itself to log
19+
config USB_CDC_ACM_LOG_LEVEL
20+
default 0
21+
22+
endif # LOG
23+
24+
endif # BOARD_MIKROE_STM32_M4_CLICKER
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2024 Ian Morris
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_MIKROE_STM32_M4_CLICKER
5+
select SOC_STM32F415XX
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Ian Morris
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board_runner_args(pyocd "--target=stm32f415rg")
5+
board_runner_args(jlink "--device=STM32F415RG" "--speed=4000")
6+
7+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
8+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Ian Morris
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board:
5+
name: mikroe_stm32_m4_clicker
6+
vendor: mikroe
7+
socs:
8+
- name: stm32f415xx
17.9 KB
Loading
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.. _mikroe_stm32_m4_clicker:
2+
3+
Mikroe STM32 M4 Clicker
4+
#######################
5+
6+
Overview
7+
********
8+
9+
The Mikroe STM32 M4 Clicker development board contains a STMicroelectronics
10+
Cortex-M4 based STM32F415RG Microcontroller operating at up to 168 MHz with
11+
1 MB of Flash memory and 192 KB of SRAM.
12+
13+
.. figure:: img/stm32_m4_clicker.webp
14+
:align: center
15+
:alt: STM32 M4 Clicker
16+
17+
STM32 M4 Clicker (Credit: MikroElektronika d.o.o.)
18+
19+
Hardware
20+
********
21+
22+
The STM32 M4 Clicker board contains a USB connector, two LEDs, two push
23+
buttons, and a reset button. It features a mikroBUS socket for interfacing
24+
with external electronics. For more information about the development
25+
board see the `STM32 M4 Clicker website`_.
26+
27+
Supported Features
28+
==================
29+
30+
The ``mikroe_stm32_m4_clicker`` board target supports the following hardware
31+
features:
32+
33+
+-----------+------------+-------------------------------------+
34+
| Interface | Controller | Driver/Component |
35+
+===========+============+=====================================+
36+
| NVIC | on-chip | nested vector interrupt controller |
37+
+-----------+------------+-------------------------------------+
38+
| UART | on-chip | serial port-polling; |
39+
| | | serial port-interrupt |
40+
+-----------+------------+-------------------------------------+
41+
| PINMUX | on-chip | pinmux |
42+
+-----------+------------+-------------------------------------+
43+
| I2C | on-chip | i2c |
44+
+-----------+------------+-------------------------------------+
45+
| SPI | on-chip | spi |
46+
+-----------+------------+-------------------------------------+
47+
| GPIO | on-chip | GPIO output |
48+
| | | GPIO input |
49+
+-----------+------------+-------------------------------------+
50+
| USB | on-chip | USB |
51+
+-----------+------------+-------------------------------------+
52+
53+
Other hardware features have not yet been enabled for this board.
54+
55+
The default configuration can be found in the defconfig file:
56+
:zephyr_file:`boards/mikroe/stm32_m4_clicker/mikroe_stm32_m4_clicker_defconfig`.
57+
58+
Programming and debugging
59+
*************************
60+
61+
Building & Flashing
62+
===================
63+
64+
You can build and flash an application in the usual way (See
65+
:ref:`build_an_application` and
66+
:ref:`application_run` for more details).
67+
68+
Here is an example for building and flashing the :zephyr:code-sample:`blinky` application.
69+
70+
.. zephyr-app-commands::
71+
:zephyr-app: samples/basic/blinky
72+
:board: mikroe_stm32_m4_clicker
73+
:goals: build flash
74+
75+
Debugging
76+
=========
77+
78+
Debugging also can be done in the usual way.
79+
The following command is debugging the :zephyr:code-sample:`blinky` application.
80+
Also, see the instructions specific to the debug server that you use.
81+
82+
.. zephyr-app-commands::
83+
:zephyr-app: samples/basic/blinky
84+
:board: mikroe_stm32_m4_clicker
85+
:maybe-skip-config:
86+
:goals: debug
87+
88+
References
89+
**********
90+
91+
.. target-notes::
92+
93+
.. _STM32 M4 Clicker website:
94+
https://www.mikroe.com/clicker-stm32f4
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/*
2+
* Copyright (c) 2024 Ian Morris
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/f4/stm32f415Rg.dtsi>
9+
#include <st/f4/stm32f415rgtx-pinctrl.dtsi>
10+
#include <zephyr/dt-bindings/input/input-event-codes.h>
11+
12+
/ {
13+
model = "Mikroe STM32 M4 Clicker";
14+
compatible = "st,stm32f415rg";
15+
16+
chosen {
17+
zephyr,console = &usb_cdc_acm_uart;
18+
zephyr,shell-uart = &usb_cdc_acm_uart;
19+
zephyr,sram = &sram0;
20+
zephyr,flash = &flash0;
21+
};
22+
23+
leds {
24+
compatible = "gpio-leds";
25+
ld1: led_1 {
26+
gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>;
27+
label = "User LED 1";
28+
};
29+
ld2: led_2 {
30+
gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>;
31+
label = "User LED 2";
32+
};
33+
};
34+
35+
gpio_keys {
36+
compatible = "gpio-keys";
37+
btn1: button_1 {
38+
label = "User Button 1";
39+
gpios = <&gpioc 0 GPIO_ACTIVE_LOW>;
40+
zephyr,code = <INPUT_KEY_0>;
41+
};
42+
btn2: button_2 {
43+
label = "User Button 2";
44+
gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
45+
zephyr,code = <INPUT_KEY_0>;
46+
};
47+
};
48+
49+
mikrobus_header: mikrobus-connector {
50+
compatible = "mikro-bus";
51+
#gpio-cells = <2>;
52+
gpio-map-mask = <0xffffffff 0xffffffc0>;
53+
gpio-map-pass-thru = <0 0x3f>;
54+
gpio-map = <0 0 &gpioa 0 0>, /* AN */
55+
<1 0 &gpiob 5 0>, /* RST */
56+
<2 0 &gpiob 12 0>, /* CS */
57+
<3 0 &gpiob 13 0>, /* SCK */
58+
<4 0 &gpiob 14 0>, /* MISO */
59+
<5 0 &gpiob 15 0>, /* MOSI */
60+
/* +3.3V */
61+
/* GND */
62+
<6 0 &gpiob 0 0>, /* PWM */
63+
<7 0 &gpiob 1 0>, /* INT */
64+
<8 0 &gpioc 11 0>, /* RX */
65+
<9 0 &gpioc 12 0>, /* TX */
66+
<10 0 &gpiob 10 0>, /* SCL */
67+
<11 0 &gpiob 11 0>; /* SDA */
68+
/* +5V */
69+
/* GND */
70+
};
71+
72+
aliases {
73+
led0 = &ld1;
74+
led1 = &ld2;
75+
sw0 = &btn1;
76+
};
77+
};
78+
79+
&clk_lsi {
80+
status = "okay";
81+
};
82+
83+
&clk_hse {
84+
clock-frequency = <DT_FREQ_M(16)>;
85+
status = "okay";
86+
};
87+
88+
&pll {
89+
div-m = <16>;
90+
mul-n = <336>;
91+
div-p = <2>;
92+
div-q = <7>;
93+
clocks = <&clk_hse>;
94+
status = "okay";
95+
};
96+
97+
&rcc {
98+
clocks = <&pll>;
99+
clock-frequency = <DT_FREQ_M(168)>;
100+
ahb-prescaler = <1>;
101+
apb1-prescaler = <4>;
102+
apb2-prescaler = <2>;
103+
};
104+
105+
&usart3 {
106+
pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>;
107+
pinctrl-names = "default";
108+
current-speed = <115200>;
109+
status = "okay";
110+
};
111+
112+
&i2c2 {
113+
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
114+
pinctrl-names = "default";
115+
status = "okay";
116+
};
117+
118+
&spi2 {
119+
pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
120+
&spi2_miso_pb14 &spi2_mosi_pb15>;
121+
pinctrl-names = "default";
122+
status = "okay";
123+
};
124+
125+
zephyr_udc0: &usbotg_fs {
126+
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
127+
pinctrl-names = "default";
128+
status = "okay";
129+
130+
usb_cdc_acm_uart: cdc_acm_uart {
131+
compatible = "zephyr,cdc-acm-uart";
132+
};
133+
};
134+
135+
mikrobus_spi: &spi2 {};
136+
mikrobus_serial: &usart3 {};
137+
mikrobus_i2c: &i2c2 {};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
identifier: mikroe_stm32_m4_clicker
2+
name: Mikroe STM32 M4 Clicker
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
ram: 128
10+
flash: 1024
11+
supported:
12+
- uart
13+
- gpio
14+
- i2c
15+
- spi
16+
- usb_device
17+
vendor: mikroe
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Ian Morris
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Enable MPU
5+
CONFIG_ARM_MPU=y
6+
7+
# Enable HW stack protection
8+
CONFIG_HW_STACK_PROTECTION=y
9+
10+
# Console
11+
CONFIG_SERIAL=y
12+
CONFIG_CONSOLE=y
13+
14+
# Enable GPIO
15+
CONFIG_GPIO=y
16+
17+
# Enable Clocks
18+
CONFIG_CLOCK_CONTROL=y
19+
20+
# Enable USB
21+
CONFIG_USB_DEVICE_STACK=y

0 commit comments

Comments
 (0)