-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <ian.d.morris@outlook.com>
- Loading branch information
1 parent
48a077f
commit 1ec3c1b
Showing
9 changed files
with
317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2024 Ian Morris | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if BOARD_MIKROE_STM32_M4_CLICKER | ||
|
||
if USB_DEVICE_STACK | ||
|
||
config UART_CONSOLE | ||
default CONSOLE | ||
|
||
config USB_DEVICE_INITIALIZE_AT_BOOT | ||
default y | ||
|
||
endif # USB_DEVICE_STACK | ||
|
||
if LOG | ||
|
||
# Logger cannot use itself to log | ||
config USB_CDC_ACM_LOG_LEVEL | ||
default 0 | ||
|
||
endif # LOG | ||
|
||
endif # BOARD_MIKROE_STM32_M4_CLICKER |
5 changes: 5 additions & 0 deletions
5
boards/mikroe/stm32_m4_clicker/Kconfig.mikroe_stm32_m4_clicker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2024 Ian Morris | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_MIKROE_STM32_M4_CLICKER | ||
select SOC_STM32F415XX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Ian Morris | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_args(pyocd "--target=stm32f415rg") | ||
board_runner_args(jlink "--device=STM32F415RG" "--speed=4000") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Ian Morris | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board: | ||
name: mikroe_stm32_m4_clicker | ||
vendor: mikroe | ||
socs: | ||
- name: stm32f415xx |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
.. _mikroe_stm32_m4_clicker: | ||
|
||
Mikroe STM32 M4 Clicker | ||
####################### | ||
|
||
Overview | ||
******** | ||
|
||
The Mikroe STM32 M4 Clicker development board contains a STMicroelectronics | ||
Cortex-M4 based STM32F415RG Microcontroller operating at up to 168 MHz with | ||
1 MB of Flash memory and 192 KB of SRAM. | ||
|
||
.. figure:: img/stm32_m4_clicker.webp | ||
:align: center | ||
:alt: STM32 M4 Clicker | ||
|
||
STM32 M4 Clicker (Credit: MikroElektronika d.o.o.) | ||
|
||
Hardware | ||
******** | ||
|
||
The STM32 M4 Clicker board contains a USB connector, two LEDs, two push | ||
buttons, and a reset button. It features a mikroBUS socket for interfacing | ||
with external electronics. For more information about the development | ||
board see the `STM32 M4 Clicker website`_. | ||
|
||
Supported Features | ||
================== | ||
|
||
The ``mikroe_stm32_m4_clicker`` board target supports the following hardware | ||
features: | ||
|
||
+-----------+------------+-------------------------------------+ | ||
| Interface | Controller | Driver/Component | | ||
+===========+============+=====================================+ | ||
| NVIC | on-chip | nested vector interrupt controller | | ||
+-----------+------------+-------------------------------------+ | ||
| UART | on-chip | serial port-polling; | | ||
| | | serial port-interrupt | | ||
+-----------+------------+-------------------------------------+ | ||
| PINMUX | on-chip | pinmux | | ||
+-----------+------------+-------------------------------------+ | ||
| I2C | on-chip | i2c | | ||
+-----------+------------+-------------------------------------+ | ||
| SPI | on-chip | spi | | ||
+-----------+------------+-------------------------------------+ | ||
| GPIO | on-chip | GPIO output | | ||
| | | GPIO input | | ||
+-----------+------------+-------------------------------------+ | ||
| USB | on-chip | USB | | ||
+-----------+------------+-------------------------------------+ | ||
|
||
Other hardware features have not yet been enabled for this board. | ||
|
||
The default configuration can be found in the defconfig file: | ||
:zephyr_file:`boards/mikroe/stm32_m4_clicker/mikroe_stm32_m4_clicker_defconfig`. | ||
|
||
Programming and debugging | ||
************************* | ||
|
||
Building & Flashing | ||
=================== | ||
|
||
You can build and flash an application in the usual way (See | ||
:ref:`build_an_application` and | ||
:ref:`application_run` for more details). | ||
|
||
Here is an example for building and flashing the :zephyr:code-sample:`blinky` application. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/basic/blinky | ||
:board: mikroe_stm32_m4_clicker | ||
:goals: build flash | ||
|
||
Debugging | ||
========= | ||
|
||
Debugging also can be done in the usual way. | ||
The following command is debugging the :zephyr:code-sample:`blinky` application. | ||
Also, see the instructions specific to the debug server that you use. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/basic/blinky | ||
:board: mikroe_stm32_m4_clicker | ||
:maybe-skip-config: | ||
:goals: debug | ||
|
||
References | ||
********** | ||
|
||
.. target-notes:: | ||
|
||
.. _STM32 M4 Clicker website: | ||
https://www.mikroe.com/clicker-stm32f4 |
137 changes: 137 additions & 0 deletions
137
boards/mikroe/stm32_m4_clicker/mikroe_stm32_m4_clicker.dts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
* Copyright (c) 2024 Ian Morris | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
#include <st/f4/stm32f415Rg.dtsi> | ||
#include <st/f4/stm32f415rgtx-pinctrl.dtsi> | ||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
|
||
/ { | ||
model = "Mikroe STM32 M4 Clicker"; | ||
compatible = "st,stm32f415rg"; | ||
|
||
chosen { | ||
zephyr,console = &usb_cdc_acm_uart; | ||
zephyr,shell-uart = &usb_cdc_acm_uart; | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
ld1: led_1 { | ||
gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>; | ||
label = "User LED 1"; | ||
}; | ||
ld2: led_2 { | ||
gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>; | ||
label = "User LED 2"; | ||
}; | ||
}; | ||
|
||
gpio_keys { | ||
compatible = "gpio-keys"; | ||
btn1: button_1 { | ||
label = "User Button 1"; | ||
gpios = <&gpioc 0 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_0>; | ||
}; | ||
btn2: button_2 { | ||
label = "User Button 2"; | ||
gpios = <&gpioc 1 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_0>; | ||
}; | ||
}; | ||
|
||
mikrobus_header: mikrobus-connector { | ||
compatible = "mikro-bus"; | ||
#gpio-cells = <2>; | ||
gpio-map-mask = <0xffffffff 0xffffffc0>; | ||
gpio-map-pass-thru = <0 0x3f>; | ||
gpio-map = <0 0 &gpioa 0 0>, /* AN */ | ||
<1 0 &gpiob 5 0>, /* RST */ | ||
<2 0 &gpiob 12 0>, /* CS */ | ||
<3 0 &gpiob 13 0>, /* SCK */ | ||
<4 0 &gpiob 14 0>, /* MISO */ | ||
<5 0 &gpiob 15 0>, /* MOSI */ | ||
/* +3.3V */ | ||
/* GND */ | ||
<6 0 &gpiob 0 0>, /* PWM */ | ||
<7 0 &gpiob 1 0>, /* INT */ | ||
<8 0 &gpioc 11 0>, /* RX */ | ||
<9 0 &gpioc 12 0>, /* TX */ | ||
<10 0 &gpiob 10 0>, /* SCL */ | ||
<11 0 &gpiob 11 0>; /* SDA */ | ||
/* +5V */ | ||
/* GND */ | ||
}; | ||
|
||
aliases { | ||
led0 = &ld1; | ||
led1 = &ld2; | ||
sw0 = &btn1; | ||
}; | ||
}; | ||
|
||
&clk_lsi { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_hse { | ||
clock-frequency = <DT_FREQ_M(16)>; | ||
status = "okay"; | ||
}; | ||
|
||
&pll { | ||
div-m = <16>; | ||
mul-n = <336>; | ||
div-p = <2>; | ||
div-q = <7>; | ||
clocks = <&clk_hse>; | ||
status = "okay"; | ||
}; | ||
|
||
&rcc { | ||
clocks = <&pll>; | ||
clock-frequency = <DT_FREQ_M(168)>; | ||
ahb-prescaler = <1>; | ||
apb1-prescaler = <4>; | ||
apb2-prescaler = <2>; | ||
}; | ||
|
||
&usart3 { | ||
pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>; | ||
pinctrl-names = "default"; | ||
current-speed = <115200>; | ||
status = "okay"; | ||
}; | ||
|
||
&i2c2 { | ||
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>; | ||
pinctrl-names = "default"; | ||
status = "okay"; | ||
}; | ||
|
||
&spi2 { | ||
pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13 | ||
&spi2_miso_pb14 &spi2_mosi_pb15>; | ||
pinctrl-names = "default"; | ||
status = "okay"; | ||
}; | ||
|
||
zephyr_udc0: &usbotg_fs { | ||
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>; | ||
pinctrl-names = "default"; | ||
status = "okay"; | ||
|
||
usb_cdc_acm_uart: cdc_acm_uart { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
}; | ||
}; | ||
|
||
mikrobus_spi: &spi2 {}; | ||
mikrobus_serial: &usart3 {}; | ||
mikrobus_i2c: &i2c2 {}; |
17 changes: 17 additions & 0 deletions
17
boards/mikroe/stm32_m4_clicker/mikroe_stm32_m4_clicker.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
identifier: mikroe_stm32_m4_clicker | ||
name: Mikroe STM32 M4 Clicker | ||
type: mcu | ||
arch: arm | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
ram: 128 | ||
flash: 1024 | ||
supported: | ||
- uart | ||
- gpio | ||
- i2c | ||
- spi | ||
- usb_device | ||
vendor: mikroe |
24 changes: 24 additions & 0 deletions
24
boards/mikroe/stm32_m4_clicker/mikroe_stm32_m4_clicker_defconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2024 Ian Morris | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Enable MPU | ||
CONFIG_ARM_MPU=y | ||
|
||
# Enable HW stack protection | ||
CONFIG_HW_STACK_PROTECTION=y | ||
|
||
# Console | ||
CONFIG_SERIAL=y | ||
CONFIG_CONSOLE=y | ||
|
||
# Enable GPIO | ||
CONFIG_GPIO=y | ||
|
||
# Enable Clocks | ||
CONFIG_CLOCK_CONTROL=y | ||
|
||
# Enable pin controller | ||
CONFIG_PINCTRL=y | ||
|
||
# Enable USB | ||
CONFIG_USB_DEVICE_STACK=y |