Mikroe MINI-M4 for STM32

Overview

MINI-M4 for STM32 is a small ARM® Cortex™-M4 development board containing an STM32F415RG microcontroller. It is pin compatible with PIC16F887 and PIC18(L)F45K20 microcontrollers and it perfectly fits into a standard DIP40 socket. The board is equipped with a 16MHz SMD crystal oscillator, and a 32.768KHz crystal which can be used for the internal RTCC module. It has a reset button and three signal LEDs. It operates on a 3.3V power supply. An on-board voltage regulator allows the board to be powered directly from a USB cable.

MINI-M4 for STM32

Pin Mapping

This port is a starting point for your own customizations and not a complete port for a specific board. Most of the GPIOs on the STM32 SoC have been exposed in the external header with silk screen labels that match the SoC’s pin names.

For more information on Pin Mapping, please refer to MINI-M4 for STM32 User Manual.

STLinkV2 connection:

The board can be flashed by using STLinkV2 with the following connections.

MINI-M4(Pin no.) ST-Link/V2(Pin no.)
PA14(36) TCK_SWCLK(9)
PA13(35) TMS_SWDIO(7)
PA15(30) TDI(5)
PB3(29) TDO_SWO(13)
GND(31) GND(8)
MCLR(1) NRST(15)
ST-Link/V2

Supported Features

The MINI-M4 for STM32 board configuration supports the following hardware features:

Interface Controller Driver/Component
NVIC on-chip nested vectored interrupt controller
PINMUX on-chip pinmux
UART on-chip serial port
GPIO on-chip gpio
I2C on-chip i2c
SPI on-chip spi
PWM on-chip PWM
USB on-chip USB

Other hardware features are not supported by the Zephyr kernel.

The default configuration can be found in the defconfig file:

boards/arm/mikroe_mini_m4_for_stm32/mikroe_mini_m4_for_stm32_defconfig

Serial Port

The Zephyr console output is assigned to USART2. Default settings are 115200 8N1.

Programming and Debugging

Applications for the mikroe_mini_m4_for_stm32 board configuration can be built and flashed in the usual way (see Build an Application and Run an Application for more details).

Flashing

The initial state of the board is set to lock. When you flash, it will fail with the message:

Error: stm32x device protected

Unlocking with openocd makes it possible to flash.

$ 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 Hello World application.

Using west:

# From the root of the zephyr repository
west build -b mikroe_mini_m4_for_stm32 samples/hello_world
west flash

Using CMake and ninja:

# From the root of the zephyr repository
# Use cmake to configure a Ninja-based buildsystem:
cmake -B build -GNinja -DBOARD=mikroe_mini_m4_for_stm32 samples/hello_world

# Now run ninja on the generated build system:
ninja -C build
ninja -C build flash

You should see the following message on the console:

Hello World! mikroe_mini_m4_for_stm32

Debugging

You can debug an application in the usual way. Here is an example for the Hello World application.

Using west:

# From the root of the zephyr repository
west debug

Using CMake and ninja:

# From the root of the zephyr repository
# If you already ran cmake with -Bbuild, you can skip this step and run ninja directly.
cmake -B build -GNinja -DBOARD=mikroe_mini_m4_for_stm32 samples/hello_world

# Now run ninja on the generated build system:
ninja -C build debug