MecrispCube for the STM32F405 (Adafruit Feather STM32F405 Express)
A new flavor for Mecrisp-Cube: Mecrisp-Cube-F405 for Adafruit's Feather STM32F405.

If you need a faster MCU (168 MHz) and FeatherWings extensions without soldering then the MecrispCubeF405 could be the right Mecrisp Forth for you. There are many stackable boards from Adafruit to choose from: displays, joysticks, actuators, sensors, etc. The only drawback is the lack of BLE, but for this there is a Mecrisp-Cube for the STM32WB55.

Instant real-time programming with Forth.


  • 32 KiB RAM dictionary Yes / Done, CCM (core coupled memory) unfortunately can not be used either for code or DMA.
  • 768 KiB Flash dictionary Yes / Done
  • Forth as CMSIS-RTOS thread. CMSIS-RTOS API to use FreeRTOS from Forth. Yes / Done
  • Buffered terminal I/O (5 KiB buffer for UART Rx). Interrupt driven and RTOS aware, key and emit block the calling thread. USART3: D0 RX, D1 TX Yes / Done
  • USB-CDC for serial communication via USB. Redirect console I/O like cdc-emit, cdc-key Yes / Done
  • microSD and internal Flash mass storage for blocks and FAT filesystem.
  • Digital and analog pins Yes / Done
    • LEDs: LED1 (red) D13, NeoPixel D8 (RGB)
    • Digital port pins: D0 to D15 (D8 NeoPixel and D7 fake, internal)
    • Analog port pins: A0 to A6 (A6 battery voltage, internal)
    • PWM:
      • TIM3: D5, D6
      • TIM4: D9, D10, D14, D15
    • Input capture TIM2: A1,
    • Output compare TIM2: D0, D1
    • EXTI: D11, D12, D13
  • SPI: J1.4 MOSI, J1.5 MISO, J1.6 SCK (e.g. for display, memory)
  • I2C: D14 SDA, D15 SCL (external peripherals Qwiic / STEMMA QT port) Yes / Done
  • vi Editor origin in BusyBox tiny vi. Workflow development: begin Edit EVALUATE while SaveFile repeat Yes / Done
  • Real Time Clock (32 bit UNIX time stamp, valid times are from 1.1.2000 to 31.12.2099 because of the STM32WB RTC peripheral) time!, time@, and .time (YYYY-MM-DDTHH:MM:SS ISO 8601). Yes / Done
  • OLED FeatherWing 128x32 Yes / Done
    • Switches: SW1 (button A, D9), SW2 (button B, D6), SW3 (button C, D5)
    • I2C: D14 SDA, D15 SCL
  • Markdown manual pages

Defaults: Digital port pins D1, D5, D6, D9 to D13 are inputs; D0 (UART_RX) is input with 100 kOhm pull-up resistor; D14 (SDA) and D15 (SCL) are open drain outputs with 10 kOhm pull-up resistors; D5, D6, and D9 with internal pull-ups.

For more BSP details see BoardSupportPackageF405.

Getting Started

These instructions will get you a copy of the project up and running on your local machine (Adafruit Feather STM32F405 Express board) for development and testing purposes.


  • Adafruit Feather STM32F405 Stackable Feather board with STM32F405 MCU runs at a blistering 168 MHz. If you want to debug you need an ST-Link debugger/programmer.
  • Terminal emulator application for PC, e.g.:
    • PuTTY - Windows and Linux
    • Tera Term - Windows
    • Realterm - Windows
    • minicom, microcom, screen - Linux
    • Use the built in Eclipse console (but no LF)

Flash the Mecrisp-Cube binary (MecrispCubeF405.bin) to the Feather Board.

  1. Connect the BOOTP (BO Pin) to 3.3V
  2. Connect the Feather Board USB to the PC
  3. Program the binary with the STMCubeProgrammer
  4. Disconnect the BOOTP (BO Pin)
  5. Reset or power cycle the Feather board

Start the terminal emulator application on the PC. Check for the serial communication port (e.g. for Linux /dev/ttyACM0). I set the putty terminal configuration to

  • Implicit CR in every LF
  • Local echo: Auto
  • Local line editing: Auto
  • Keyboard Backspace: Control-H
  • Keyboard Function: Keys VT100
  • Remote character set: CP850

Mecrisp-Stellaris RA 2.5.4 by Matthias Koch.

Mecrisp-Cube 1.4.2 for STM32F405, 31/768 KiB RAM/FLASH dictionary (C) 2021
  * Firmware Package STM32Cube F4 V1.26.0, USB-CDC (C) 2021 STMicroelectronics
  * CMSIS-RTOS V2 FreeRTOS wrapper, FreeRTOS Kernel V10.3.1 (C) 2020
  * FatFs for internal flash and microSD - Generic FAT fs module  R0.12c (C) 2017 ChaN
  * tiny vi - part of BusyBox (C) 2000, 2001 Sterling Huxley

23 5 / .[CR] 4  ok.
: hello ." World" ;[CR]  ok.
hello[CR] World ok.


A step by step series of examples that tell you how to get a development env running

Install the IDE STM32CubeIDE, it is Eclipse and GCC based. STM32CubeMX is included in the IDE, you need a stand alone installation only if you do not want to use the STM32CubeIDE.

Get the sources from github:

psi@homer:~> git clone --branch F405
Klone nach 'Mecrisp-Cube' ...
remote: Enumerating objects: 1157, done.
remote: Counting objects: 100% (1157/1157), done.
remote: Compressing objects: 100% (620/620), done.
remote: Total 3183 (delta 720), reused 934 (delta 525), pack-reused 2026
Empfange Objekte: 100% (3183/3183), 41.60 MiB | 6.96 MiB/s, Fertig.
Löse Unterschiede auf: 100% (2100/2100), Fertig.

Import the project into the IDE:

File -> Import -> General -> Existing Projects into Workspace -> Select root directory
Copy project into workspace
Browse to Mecrisp-Cube directory

Generate code from the STM32CubeMX MecrispCubeF405.ioc file:

Project -> Generate Code 

Restore changed source files

$ git status
{list of changed files}
$ git restore {files to restore} 

Select the Build Configuration (Debug if you want to debug the project) and Build the project:

Project -> Build Configurations -> Set Active -> Debug/Release 
Project -> Build Project

-- Peter Schmid - 2020-04-11

Creative Commons License
This work by Peter Schmid is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg F405-4382-09.jpg r2 r1 manage 161.4 K 2021-03-05 - 16:30 PeterSchmid  
JPEGjpg mecrisp-cube-f4.jpg r1 manage 1014.7 K 2021-03-10 - 21:25 PeterSchmid  
Edit | Attach | Watch | Print version | History: r23 < r22 < r21 < r20 < r19 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r23 - 2021-04-12 - PeterSchmid
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback