Computing stuff tied to the physical world

Making a Black Magic Probe

As already mentioned, the Black Magic Probe is a nifty little tool, and it works for ARM chips from many different vendors. Due to the fact that its software has been open-sourced and runs on a low-end STM32F103, this tool is fairly easy to make yourself.

It should come as no surprise that this is, again, one of those chicken-and-egg situations: you need to upload the BMP firmware to your setup to be able to turn it into a BMP. So there’s no escape – you either need to buy an official BMP from Blacksphere, or use one of the other methods described in the previous article, or get some other pre-loaded unit.

Here’s a collection of three different BMP builds, alongside the “real” thing:

DSC 5233

From left to right: an STM Discovery F0 board, an STM32F103C8 board off eBay, a HY-TinySTM103T board, and the tiny real Black Magic Probe by Black Sphere Technologies.

The STM Discovery F0 is a low-cost evaluation & development board from STM. It has a built-in ST-Link (top half of the board) and a lowly STM32F051 on the bottom, which is what you’re supposed to evaluate and use this board for. Turning it into a BMP equivalent means simply ignoring that lower part. The instructions on how to convert this board has been on the web at for several years now.

It’s a rather complicated process, you need to unsolder and re-solder jumpers on the back of the board, but it works fine, and requires nothing more than the stlink utility software (or the serial ROM boot, if you prefer).

Note that once you have a BMP, you can use it to re-flash other chips, and create a second BMP. This might seem superfluous, but since debugger access is so convenient, it really can be useful. Furthermore: one BMP can be used to re-flash updated firmware onto the other.

The eBay unit is one of many such boards, with lots of pins and the proper STM µC on it. The “C8” version has 64 KB of flash, which is (just) enough for the original BMP code, but there may come a time when this code grows beyond that size. Having a “TB” / “CB” / “RB” model with 128 KB of flash will allow you to run future more extensive firmware.

The board on top was hacked together – it ties the relevant pins to a 6-pin female header (bit hard to see, as it covers the 20-pin JTAG socket). This 6-pin header matches the HY-TinySTM103T board, which from left to right has: +3.3V, TX, RX, SWDIO, SWCLK, GND.

The third board is a HT-TinySTM103T, turned into a BMP itself. So this is an example of a board which can be used as target as well as for SWD-based uploading and debugging. Here is an example of an ST-Link used to upload the BMP firmware to such a “HyTiny”:

DSC 5163

(note: the SWDIO/SWCLK labels on the HyTiny are incorrect, they are in fact swapped)

Turning a HyTiny into a convenient BMP unit requires a bit of soldering:

DSC 5204

That’s the bottom view of two HyTiny’s. The one on the left is now a BMP. Note the extra 10 KΩ pull-down resistor between PA0 and GND. This permanently enables the USB port.

The reason for this, is that we’re using a pre-compiled BMP image, created by Rick Kimball and published on the STM32duino forum. His “” archive has the binary (in .bin and .elf format) which you need to get onto your BMP-to-be.

Last but not least in our overview image, is the official Black Magic Probe on the right. This comes with a 0.05″ pitch ribbon cable, which is used on some new boards. The Olimexino-STM32 uses it, as well as most of the NXP-/LPC-based boards from Embedded Artists.

There are various adapters to go from mini-10 to std-10 to the “big” std-20 JTAG sockets still used on many of these boards. That’s what that eBay unit has, for example.

Note that all the SWD pins are also available on these common JTAG connector types:

JTAG SWD 20pin connector10pin

One last detail to keep in mind with all these SWD / JTAG programmers, is that some of the units power the target board they connect to (with with 3.3V or 5V, it differs!) – but most units are set up as non-invasive “probes”, i.e. you’re supposed to power the target board by other means, with the JTAG / SWD unit merely used for peeking and poking at it.

With the four units above, you can see this already: the Discovery and real BMP both act as non-powering probes (they measure VCC, i.s.o. of feeding it). Whereas the custom-made ones for the HyTiny board have been configured to also provide power to the attached unit.

So there you have it. The BMP is an excellent tool to have around, even if you use other means (such as USB-based uploads) for day-to-day use. It doubles as a serial port interface (like the FTDI), and it has the useful property that the two virtual serial ports it presents to the host over USB require no driver installation on Windows, Mac OSX, and Linux.

[Back to article index]