Tags:
view all tags
%DASHBOARD{ section="dashboard_start" }% %DASHBOARD{ section="banner" image="%PUBURLPATH%/MecrispCube/BoardSupportPackageF405/feather-stm32f405-head.jpg" title="Mecrisp-Cube for the !STM32F405 (Adafruit Feather !STM32F405 Express)" titlestyle="color:#F00000;" }% %DASHBOARD{ section="box_start" title="Intro" width="485" height="300"}% A new flavor for Mecrisp-Cube: _Mecrisp-Cube-F405_ for [[https://www.adafruit.com/product/4382][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 [[BoardSupportPackageWB][STM32WB55]]. [[WebHome][Mecrisp-Cube]] Instant real-time programming with Forth. Sources on [[https://github.com/spyren/Mecrisp-Cube/tree/F405][GitHub]] (F405 branch on Mecrisp-Cube) %IMAGE{"%PUBURLPATH%/MecrispCube/MecrispCubeF405/mecrisp-cube-f4.jpg" type="thumb" caption=""}% %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" title="Contents" width="460" height="300"}% %TOC% %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="600" }% ---+ Features * 32 !KiB RAM dictionary %ICON{choice-yes}%, CCM (core coupled memory) unfortunately can not be used either for code or DMA. * 768 !KiB Flash dictionary %ICON{choice-yes}% * Forth as CMSIS-RTOS thread. CMSIS-RTOS API to use [[https://en.wikipedia.org/wiki/FreeRTOS][FreeRTOS]] from Forth. %ICON{choice-yes}% * Buffered [[TerminalIO][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 %ICON{choice-yes}% * [[TerminalIO#USB_CDC_Serial_Communication_API][USB-CDC]] for serial communication via USB. Redirect console I/O like =cdc-emit=, =cdc-key= %ICON{choice-yes}% * [[MicroSdBlocks][microSD and internal Flash mass storage]] for blocks and FAT filesystem. %ICON{choice-yes}% * Internal Flash drive 0:, 2 !MiB serial Flash !W25Q16 * microSD drive 1: * [[MicroSdBlocks#Filesystem_API][Filesystem API]] * [[MicroSdBlocks#UNIX_like_Shell_Commands][UNIX like Shell commands]] * Digital and analog pins %ICON{choice-yes}% * 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: D2 SCK, D3 MISO, D4 MOSI (e.g. for display, memory) * !I2C: D14 SDA, D15 SCL (external peripherals Qwiic / STEMMA QT port) %ICON{choice-yes}% * [[EditorVi][vi Editor]] origin in !BusyBox tiny vi. Workflow development: =begin Edit EVALUATE while !SaveFile repeat= %ICON{choice-yes}% * [[RealTimeClock][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). %ICON{choice-yes}% * [[OledDisplay][OLED]] [[https://www.adafruit.com/product/2900][FeatherWing]] 128x32 %ICON{choice-yes}% * Switches: SW1 (button A, D9), SW2 (button B, D6), SW3 (button C, D5) * !I2C: D14 SDA, D15 SCL * CharlieWing %ICON{choice-yes}% * NeoPixelWing %ICON{choice-yes}% * DotStarWing * QuadAlphanumeric !FeatherWing Display * [[MarkdownManual][Markdown manual pages]] For more BSP details see BoardSupportPackageF405. %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="600" }% ---+ 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. ---++ Prerequisites * [[https://www.adafruit.com/product/4382][Adafruit Feather STM32F405]] Stackable Feather board with !STM32F405 MCU runs at a blistering 168 MHz. If you want to debug C and assembler programs you need an ST-Link debugger/programmer. * Terminal emulator application for PC, e.g.: * [[http://www.putty.org/][PuTTY]] - Windows and Linux * [[http://en.sourceforge.jp/projects/ttssh2/][Tera Term]] - Windows * [[http://realterm.sourceforge.net/][Realterm]] - Windows * minicom, microcom, screen - Linux * Use the built in Eclipse console (but no LF) Flash the Mecrisp-Cube [[https://github.com/spyren/Mecrisp-Cube/raw/F405/Release/MecrispCubeF405.bin][binary]] (=MecrispCubeF405.bin=) or the [[https://github.com/spyren/Mecrisp-Cube/raw/F405/sdcard/boot/MecrispCubeF405Util.bin][util-binary]] (=MecrispCubeF405Util.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 [[https://github.com/spyren/Mecrisp-Cube/raw/F405/Release/MecrispCubeF405.bin][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 <pre> Mecrisp-Stellaris RA 2.5.4 by Matthias Koch. Mecrisp-Cube 1.4.3 for STM32F405, 31/768 KiB RAM/FLASH dictionary (C) 2021 peter@spyr.ch * Firmware Package STM32Cube F4 V1.26.0, USB-CDC (C) 2021 STMicroelectronics * CMSIS-RTOS V2 FreeRTOS wrapper, FreeRTOS Kernel V10.3.1 (C) 2020 Amazon.com * FatFs for serial flash and microSD - Generic FAT fs module R0.12c (C) 2017 ChaN * tiny vi - part of BusyBox (C) 2000, 2001 Sterling Huxley include 0:/etc/rc.local <b>23 5 / .[CR]</b> 4 ok. <b>: hello ." World" ;[CR]</b> ok. <b>hello[CR]</b> World ok. </pre> ---++ Additional Tools and Local Filesystem Populate a microSD with the contents of [[https://github.com/spyren/Mecrisp-Cube/tree/F405/sdcard][sdcard]]. Put the microSD into the F405 slot and reset or power cycle the board. The directory should look like this: <pre> <b>ls -l 1:[CR]</b> drw- 0 2021-04-18T18:12:38 boot drw- 0 2021-03-21T18:47:52 etc drw- 0 2021-03-21T18:47:54 fsr drw- 0 2021-03-21T18:47:54 home drw- 0 2021-03-21T18:47:56 man -rwa 7219 2021-01-08T19:42:36 README.md ok. </pre> You can use the local CLI commands like =mkfs=, =mkdir= and =cp= to create a filesystem on the serial flash and fill it with files and folders. But this is tedious job because I haven't yet implemented a recursive copy for !MecrispCube. But there is prepared disk image (for details see MicroSdBlocks#Serial_Flash) on microSD and the tool =dd=. You can copy the disk image to the drive 0: (this takes about 2 Minutes): <pre> <b>dd 1:/boot/fd-2MiB.img 0:[CR]</b> ok. <b>mount 0:[CR]</b> ok. <b>ls 0:[CR]</b> man fsr README.md boot etc home ok. </pre> The Mecrisp have some tools bundled in its distribution e.g. assembler, disassembler, dump, float. I put those tools and some more into the folder =/fsr=. With the "init.fs script" I compile my favorite ones into the flash directory: <pre> <b>compiletoflash[CR]</b> ok. <b>include /etc/init.fs[CR]</b> init.fs Loading started RAM Dictionary: 392991 KiB utils.fs loading ... conditional.fs loading ... dump.fs loading ... disassembler-m3.fs loading ... float.fs loading ... threads.fs loading ... RAM Dictionary: 392981 KiB init.fs finished ok. </pre> For example, the word disassember is available now: <pre> <b>see dump[CR]</b> 080405F0: B500 push { lr } 080405F2: F7C2 bl 08002A3E --> cr 080405F4: FA24 080405F6: CF08 ldmia r7 { r3 } 080405F8: F013 ands r2 r3 #F 080405FA: 020F 080405FC: F847 str r3 [ r7 #-4 ]! 080405FE: 3D04 08040600: 2A00 cmp r2 #0 08040602: D000 beq 08040606 08040604: 3610 adds r6 #10 08040606: CF08 ldmia r7 { r3 } 08040608: F847 str r6 [ r7 #-4 ]! </pre> ---++ Installing A step by step series of examples that tell you how to get a development env running Install the IDE [[https://www.st.com/en/development-tools/stm32cubeide.html][STM32CubeIDE]], it is Eclipse and GCC based. [[https://www.st.com/en/development-tools/stm32cubemx.html][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: <pre> psi@homer:~> <b>git clone --branch F405 https://github.com/spyren/Mecrisp-Cube</b> 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. </pre> Import the project into the IDE: <pre> File -> Import -> General -> Existing Projects into Workspace -> Select root directory Copy project into workspace Browse to Mecrisp-Cube directory </pre> Generate code from the !STM32CubeMX =MecrispCubeF405.ioc= file: <pre> Project -> Generate Code </pre> Restore changed source files <pre> $ git status {list of changed files} $ git restore {files to restore} </pre> Select the Build Configuration (Debug if you want to debug the project) and Build the project: <pre> Project -> Build Configurations -> Set Active -> Debug/Release Project -> Build Project </pre> %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="700" }% ---+ Adafruit Feather !STM32F405 Express Board <img src="%ATTACHURLPATH%/F405-4382-09.jpg" alt="F405-4382-09.jpg" width="616" height="445" /> * https://www.adafruit.com/product/4382 * https://learn.adafruit.com/adafruit-stm32f405-feather-express/pinouts * Schematic https://cdn-learn.adafruit.com/assets/assets/000/083/680/original/feather_boards_schem.png?1573012880 * Other similar boards with STM32F4 MCU: * SparkFun Thing Plus - STM32 https://www.sparkfun.com/products/17712 * Black Pill https://stm32-base.org/boards/STM32F407VET6-STM32-F4VE-V2.0.html * Mamba F405 Flight Controller https://www.banggood.com/de/9g-30_5x30_5mm-Omnibus-F4-Flight-Controller-AIO-OSD-5V-BEC-Current-Sensor-for-RC-FPV-Racing-Drone-p-1226610.html * !MicroPython pyboard - v1.1 https://www.adafruit.com/product/2390 * !STM32F411 "BlackPill" Development Board https://www.adafruit.com/product/4877 * Adadfruit !MicroPython Pyboard Lite v1.0 - STM32F411 https://www.adafruit.com/product/5417 * !STM32F405 Datasheet DS8626 https://www.st.com/resource/en/datasheet/stm32f405rg.pdf * !STM32F405 Reference Manual RM0090 https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405415-stm32f407417-stm32f427437-and-stm32f429439-advanced-armbased-32bit-mcus-stmicroelectronics.pdf * STM32 Cortex M4 MCUs Programming Manual PM0214 %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="dashboard_end" }% -- %USERSIG{PeterSchmid - 2020-04-11}% <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work by <a xmlns:cc="http://creativecommons.org/ns#" href="http://spyr.ch" property="cc:attributionName" rel="cc:attributionURL">Peter Schmid</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
jpg
F405-4382-09.jpg
r2
r1
manage
161.4 K
2021-03-05 - 16:30
PeterSchmid
jpg
mecrisp-cube-f4.jpg
r1
manage
1014.7 K
2021-03-10 - 21:25
PeterSchmid
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r38
<
r37
<
r36
<
r35
<
r34
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r36 - 2022-04-28
-
PeterSchmid
Home
Site map
Cosmac web
MRR web
MecrispCube web
SuperRandonnee web
TWiki web
Ursula web
Velo web
MecrispCube Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Edit
Attach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback