Skip to content
Manuel Bleichenbacher edited this page Jan 6, 2023 · 3 revisions

#$ 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

Upload Firmware

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.

Providing power

If you debug probe does not provide power to the ZY12PDN board, it needs to be supplied differently for uploading the firmware. The options are:

  • Feed power to the USB connector from a non USB PD power supply
  • Feed 3.3V to the VCC pad on the bottom side of the board
  • Feed 5V to the output terminal

Do not connect the board to a USB PD power supply during firmware upload. There is a conflict between the FUSB302 interrupt line and the SWDIO line. The interrupt line is activated as soon as a USB PD power source is detected. From that moment, it is no longer possible to use SWD.

Flash Protection

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"

Revive Board

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.

Clone this wiki locally