How to install MicroPython on STM32F4 WeAct blackpill board?

How to install MicroPython on STM32F4 WeAct blackpill board?
typescript
Ethan Jackson

It's not really clear how to install MicroPython on WeAct boards. This might help

Answer

First I got troubles when connecting board to usb-C PC port (burn the board !), so now I use USB-A port (which is only 5V).

That's not really clear when you buy the board on internet, but microPython firmware is not installed by default on WeAct boards.

Steps :

  1. clone micropython repository : git clone https://github.com/micropython/micropython

  2. go to boards subfolder : cd micropython/ports/stm32/boards/

  3. clone WeAct board definition : git clone https://github.com/mcauser/WEACT_F411CEU6.git

  4. cd ..

  5. install gcc-arm : apt install gcc-arm-none-eabi

  6. make submodules

  7. make BOARD=WEACT_F411CEU6 : this should produce build-WEACT_F411CEU6/firmware.dfu file

  8. add udev rule :

    1. sudo nano /etc/udev/rules.d/99-weact.rules

    2. set this content : SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", GROUP="plugdev", MODE="660"

  9. plug the board in and perform :

    1. press and hold BOOT0 button

    2. press and hold NRST button

    3. wait 0.5s

    4. release NRST button

    5. release BOOT0 button

  10. dfu-util -l should list the board

  11. flash micropython firmware via DFU : sudo make BOARD=WEACT_F411CEU6 deploy

  12. unconnect/reconnect usb cable => it should work

.

How to verify that it works ?

  1. There should be a new ttyACM0 device (ls /dev/ttyA*)

  2. there should be a mounted device with some files like main.py and boot.py

  3. when connecting to ttyACM0, you should have REPL python interface

.

How to program ?

You can use for example Thonny IDE :

https://github.com/thonny/thonny/wiki/MicroPython

(do not know if it's the better option as I just starting now)

.

What's blinky program ?

from pyb import LED import time led = LED(1) while True: led.on() time.sleep(0.25) led.off() time.sleep(0.5)

.

Hope it will help !

Related Articles