Components

1 x WeAct Studio STM32F411CE Microcontroler board
1 x ST-Link Mini v2 programmer
1 x USB-A to USB-C cable

Description

There is not currently a pre-built binary image for the STM32F411 board which is commonly sold on AliExpress, and a few steps are required in order to patch, build, and flash the device.

This article is written assuming you will be using a Linux-based system to flash your board.

Steps

1) Install the stlink tools on your system. For Arch Linux these are available in the stlink community package. These tools will enable you to use the ST-Link programmer to flash your board.

2) Connect the ST-Link to your STM32 board: SWDIO->SW, GND->GND, SWCLK->CLK, 3.3v->3v3. Connect the ST-Link USB device to your Linux system. You can use commands such as stlink-gui to connect to the board. More information at the project’s GitHub page.

3) We will now be following instructions from the WeAct F411CE GitHub page. To compile MicroPython for the ARM processor on the STM32 board, you will need to install the necessary GCC pacakges: arm-none-eabi-binutils,arm-none-eabi-gcc and arm-none-eabi-newlib.

git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
cd mpy-cross
make -j4
cd ../ports/stm32/boards
git clone https://github.com/WeActTC/WeAct_F411CE-MicroPython.git WeAct_F411CE
cd ..
make BOARD=WeAct_F411CE -j

The steps above are:

  • Clone the MicroPython repository
  • Update the submodules in the MicroPython repository
  • Clone the WeAct patch for their F411CE version of the STM32 board
  • Make the binary image files for flashing to your board

4) The build process should proceed and result in compiling firmware0.bin and firmware1.bin in the ...micropython/ports/stm32/build-WeAct_F411CE directory.

5) We will now copy the binary image files to the board:

  • Reboot your board in BOOT mode by pressing and holding the BOOT0 button. While it is pressed, press and release the NRST button. Then release the BOOT0 button.
  • Write the first part of the binary image to the board with: st-flash write firmware0.bin 0x8000000. This should write successfully, if not, try the command again. It should write and verify successfully.
  • Write the second part of the binary image file to the board with: st-flash write firmware1.bin 0x8020000. This should write successfully. If not, try putting the board in to BOOT mode again as described above and try the command again. It should write and verify successfully.

6) Once writing and verifying are completed successfully, you can now disconnect the ST-Link and connect your board to your Linux system using the USB-C cable.

7) Thonny or your development environment of your choice should now be able to connect to the MicroPython REPL running on the rebooted board.

Done!


Related Posts


Published

Category

Linux, STM32F411, MicroPython, STM32, Black Pill

Tags

Contact