bringing up an adafruit stm32f405 feather express

I purchased an Adafruit STM32F405 Feather ( https://www.adafruit.com/product/4382 ). I purchased it because it has an STM32, a SoC built around an ARM M4 with hardware floating point, clocked at 168MHz. You can check the full specs on the provided link. Because it’s an Express board, it will run Adafruit’s Circuit Python ( https://github.com/adafruit/circuitpython ), Adafruit’s fork of MicroPython ( http://micropython.org ). In this post I’m going to install the latest version of Circuit Python (as of the date of this post) on the Feather and test it with a simple Python application that flashes the on-board NeoPixel different colors.

All of this is hosted on a 2020 M1 13″ MacBook Pro running macOS Monterey version 12.0.1.

We’ll start by installing a helper application that will program the STM32 with the Circuit Python binary. I’ll use Homebrew ( https://brew.sh ) to install dfu-util (brew install dfu-util). I’ll then go to https://circuitpython.org/board/feather_stm32f405_express/ and download the latest version of Circuit Python, which as of right now is 7.0.0.  Save it somewhere you will remember for later. The file I downloaded was adafruit-circuitpython-feather_stm32f405_express-en_US-7.0.0.bin

Plug the Feather into one of the Mac’s USB-C ports. You’ll need a USB-C to USB-C cable for this; the STM32 Feather (finally!) is equipped with USB-C instead of micro USB.

Take a wire and connect the B0 pin to 3.3V (see image below). This is the bootloader wire. Press the reset key to put the Feather into bootloader mode.

On your host computer open a shell. I use iTerm which in turn uses zsh, the shell for macOS. Change directory to where you stored the downloaded binary (bin) file and use dfu-util to program the Feather with this file. Execute the following:

dfu-util -a 0 --dfuse-address 0x08000000 -D adafruit-circuitpython-feather_stm32f405_express-en_US-7.0.0.bin

When Feather programming finishes, unplug the Feather from USB-C, remove the bootloader wire, and reconnect the Feather. The Feather will now appear as a flash device on the Mac and it will execute Circuit Python programs stored on the flash device. What follows is the Feather’s flash filesystem:


When first booted after the initial Circuit Python programming, there is no file in the lib folder. You’ll need to add this yourself. Go to https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel and download, from releases, adafruit-circuitpython-neopixel-7.x-mpy-6.2.3.zip. Unzip this file and look for lib/neopixel.mpy. Drag neopixel.mpy into the Feather’s lib directory, so that it looks like the image above.

Test Code

Using the code editor of your choice, open the file code.py on the Feather and delete everything you find. Then copy and paste the following:

import timeimport boardimport neopixelneopixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2, auto_write=False, pixel_order=neopixel.GRB)while True:neopixel.fill((64,0,0)) # redneopixel.show()time.sleep(1)neopixel.fill((0,64,0)) # greenneopixel.show()time.sleep(1)neopixel.fill((0,0,64)) # blueneopixel.show()time.sleep(1)neopixel.fill((64,16,0)) # orangeneopixel.show()time.sleep(1)neopixel.fill((0,32,32)) # cyanneopixel.show()time.sleep(1)neopixel.fill((0,0,0)) # blackneopixel.show()time.sleep(5)

All you have to do is save the file, and the Feather will start to execute it immediately.