Skip to content

Firmware Programming

Keir Fraser edited this page Jan 30, 2021 · 21 revisions

NOTE: If you have a pre-assembled Greaseweazle device, or a kit with the STM chip pre-soldered, then it is already programmed and you should skip this section!!

WARNING: Do not connect to the Greaseweazle USB port during programming. Greaseweazle is powered by your programmer: bad things may happen if you simultaneously provide USB power.

Programming requires an ST-Link v2 programmer, clones of which are available cheaply on Ebay. The clones are recommended over the official programmer because they are much cheaper, and because they also power the board during programming; the official programmer requires the Greaseweazle to be powered separately.

Example ST-Link v2 clone

Connect the programmer to the DEBUG header of the F7 board, or the right-angle four-pin header of the Blue Pill board:

Programmer Blue Pill F7 DEBUG
SWCLK DCL CK
SWDIO DIO DIO
GND GND GND
3.3V 3.3 3V31
  1. F7 PCB Rev 1: Pin is named VCC

WARNING: Do not connect to the programmer's 5.0V pin as you will destroy your STM32 chip!

Windows:

  • Download the firmware zip file from here.
  • Download and run the ST-Link software (STSW-LINK004).
  • Connect your ST-Link programmer (not Greaseweazle!) to your Windows PC via USB.
  • Click Connect to the target in the ST-Link software.
  • Click Open file and open the correct HEX file for your board (F1 HEX file for Blue Pill, F7 HEX file for F7 boards).
  • Click Program verify

MacOS / Linux:

  • Download the firmware zip file from here.
  • Install stlink: brew install stlink
  • Connect your ST-Link programmer (not Greaseweazle!) to your Mac via USB.
  • Identify the correct HEX file for your board (F1 HEX file for Blue Pill, F7 HEX file for F7 boards).
  • Write the file: st-flash --reset --format ihex filename
  • Ensure no errors were reported