First, I got troubles when connecting a board to a USB-C PC port (burn the board!), so now I use a USB-A port charger (which is only 5 V).
That's not really clear when you buy the board on the Internet, but MicroPython firmware is not installed by default on WeAct boards.
Here is how you can build and flash the firmware to make it working.
Prerequisites:
- Use a PC running Linux with apt,
- if needed install
git, dfu-util and gcc-arm-none-eabi packages:
apt install git dfu-util gcc-arm-none-eabi
Steps:
clone the MicroPython repository: git clone https://github.com/micropython/micropython
go to the boards subfolder: cd micropython/ports/stm32/boards/
clone the WeAct board definition: git clone https://github.com/mcauser/WEACT_F411CEU6.git
cd ..
make submodules
make BOARD=WEACT_F411CEU6: this should produce build-WEACT_F411CEU6/firmware.dfu file
add a udev rule:
sudo nano /etc/udev/rules.d/99-weact.rules
set this content : SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", GROUP="plugdev", MODE="660"
plug the board in and perform:
press and hold the BOOT0 button
press and hold the NRST button
wait 0.5 seconds
release the NRST button
release the BOOT0 button
dfu-util -l should list the board
flash micropython firmware via DFU: sudo make BOARD=WEACT_F411CEU6 deploy
disconnect/reconnect the USB cable, and it should work
How can we verify that it works?
There should be a new ttyACM0 device (ls /dev/ttyA*)
there should be a mounted device with some files, like main.py and boot.py
when connecting to ttyACM0, you should have a REPL Python interface
How can we program it?
You can use, for example, Thonny IDE. See, e.g., on GitHub.
(I do not know if it's the better option as I just starting now.)
What's the 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)