Set up a STM32 bluepill as a blackmagic probe for beginner
# Set up a STM32 bluepill as blackmagic probe

There exist a very nice solution to flash the PineTime called [Blackmagic]( probe.
Rather than connecting with OpenOCD or JLink to the probe you can just open the debugger gdb and connect to the PineTime.

The Blackmagic probe was an crowdfunding development and the source is available on Github and crucially there are also versions for other hardware than the blackmagic probe device. If you regularly work or develop with embedded devices it is probably worth to buy the original Blackmagic probe. If you are new and want to try things before spending more money there is an inexpensive option.

You can flash the blackmagic binary to a device generally called [STM32 bluepill](, a small ARM M3 micro controller board which is widely available for cheap.

This approach works, it however comes with it's own challenges:
1. A practical issue, the blackmagic.bin is larger than 64k but the flash memory of the bluepill is officially only 64k. The thing is unofficially the chip actually supports 128k but there seems to be a production selection process and you cannot be sure if your device supports 128k.
2. To flash the STM32 bluepill you need a st-link or serial flash device or something, but you want the blackmagic probe because you don't have that
3. The chip on the STM32 bluepill is called STM32F103C8T6. There are quite a lot of cheap(er) chinese clones of this chip out there often called CS32F103C8T6 and there can be problems with those.

So as a beginner, what to do ?
Searching on ebay I found one product in the UK that helped with the problems above.

[Link to STM32 bluepill on ebay](

The seller claims to use the original chip, but crucially also one that supports 128k. Also and this is important, the seller has uploaded the Ardoino (Maple) bootloaded already. This means you can access the bluepill with the USB port right away and do not need another connection.

Obviously I don't know the seller and can't give any assurance that it always workes, but it did work in my case.

I would guess that you can find similar offers in other countries.

So, if you have a STM32 bluepill tha has already the [bootloader]( installed then you can follow these steps to convert the STM32 bluepill into a blackmagic probe.

1. Install `dfu-util` if you don't have it already
2. Download [blackmagic binary]( For the bluepill the `st-link` variant is required. You can download the latest nightly from [here](
3. Connect the bluepill with an usb cable and check the dmesg for the connection message. Then check with `dfu-util -l` how it is listed.
4. In my case the device showed three lines, the only difference is the alt(ernative) flag from ( 0..2). For this guide you need alternative 2. The flag `-a 2` stands for alternative 2
5. Check the device ID. Mine was 1eaf:003 but I have seen other IDs in other guides. If you have a different ID you have to adjust the command in the next step
6. flash the blackmagic binary with this command:

sudo dfu-util -d 1eaf:003 -a 2 -D blackmagic-stlink.bin

__Note: in other guides you see a variant of this command with a flag `-s` and the address where to flash the binary. This is the function of the alternatives here and not required here__

It might be required to press the reset button on the board shortly before flashing

You should see a progress bar and then a happy result.

7. Reset the board.
8. The commands `lsusb` and `dfu-util -l` show the new device.
9. The gdb debugger is available as `/dev/ttyACM0`
10. See here for a [gdb getting started guide](

Sorry for the markdown format, The forum formatting seems not to be supported by Pandoc

More useful links:

Messages In This Thread
Set up a STM32 bluepill as a blackmagic probe for beginner - by Surehand53 - 01-17-2020, 09:59 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)