-
Notifications
You must be signed in to change notification settings - Fork 28
Build and upload
#$ Build Firmware
-
Clone the project from GitHub
-
Open it with Visual Studio Code
-
Install the PlatformIO extension
-
Click the build icon in the status bar
The ZY12PDN board has 4 pads for SWD at the bottom.
Either solder wires to them, or use a 4-pin adapter with pogo pins to connect a debug adapter.
Connect the SWD pads with an ST-Link, J-Link or Black Magic Probe to your computer and click the upload icon in the status bar of Visual Studio Code.
As sold, some of the boards have flash protection enabled. It can be disabled using openocd. Note: This command erases the flash memory.
openocd -f interface/stlink.cfg -f target/stm32f0x.cfg -c "init; reset halt; stm32f0x unlock 0; stm32f0x mass_erase 0; reset halt; exit"
If the board can no longer be flashed with the SWD connector on the back side because the firmware cannot stop the PD controller from interfering with the SWDIO line, the board can be revive like so:
-
Solder a wire to NRST. The easiest location for soldering is capacitor C6 (on the left side of the capacitor, see components).
-
Connect all four SWD pins plus NRST to a debug adapter.
-
Use a firmware upload/erase configuration that connects under reset.
-
Erase the flash.
I've been successful with a J-Link adapter and J-Flash Lite (but not with J-Flash). An ST-Link adapter and the proper configuration might also work if you know how.