Question: I have a Blue Pill and I'd like to program it using [TinyGo](https://tinygo.org/microcontrollers/bluepill/) but the Blue Pill had no (obvious) means for hardware programming. So, I bought an [STLINK-V3MINI](https://www.st.com/en/development-tools/stlink-v3mini.html) hoping to use JTAG/SWD to program it. I'm uncertain how to connect the two and am seeking guidance before I naively connect the two and zap something.

[![Blue Pill](https://i.stack.imgur.com/Eah43.png)](https://i.stack.imgur.com/Eah43.png)

Here's the STLINK-V3MINI:

[![STLINK-V3MINI](https://i.stack.imgur.com/XgyR3.png)](https://i.stack.imgur.com/XgyR3.png)

Here's the STDC14 connector:

[![STDC14](https://i.stack.imgur.com/52Tp6.png)](https://i.stack.imgur.com/52Tp6.png)

Page 19 of the STLINK's [user guide](https://www.st.com/content/ccc/resource/technical/document/user_manual/group1/00/14/17/68/0f/01/48/01/DM00555046/files/DM00555046.pdf/jcr:content/translations/en.DM00555046.pdf) has a pinout for the STDC14 but I can't correlate this to the TinyGo's documentation that suggests needing `SWIO`, `SWCLK`,3v and `GND`.

Answer: 
The ribbon cable is attached to the STDC14 connector and the pinout is described in chapter 9.1.3.

[![STDC14 connector pinout](https://i.stack.imgur.com/UeZ9w.png)](https://i.stack.imgur.com/UeZ9w.png)

The relevant pins are:

* Pin 4: T\_SWDIO aka SWDIO aka SWIO
* Pin 6: T\_SWCLK aka SWCLK
* Pins 5 and 7: GND (choose either one)

The STLINK V3 cannot supply power to the Blue Pill (see note at the end of chapter 1). So the easiest solution is to supply power by connecting it to a USB port. 

I'm not entirely sure how the ribbon cable is connected. Most likely, the red wire corresponds to pin 1 and the other pins follow in order. On the connector itself (looking at it the same way as on the picture), pin 1 would be bottom right (right side because of red wire, bottom side because it is closer to the notch). Better check it out with the continuity tester of a multi-meterr.

On the Blue Pill, the relevant pins are on the short side:

[![Blue Pill Pinout](https://i.stack.imgur.com/SvzIh.png)](https://i.stack.imgur.com/SvzIh.png)
I made the adapter STDC14 to "Bluepill" according to the wiring below.

Worked fine with both STLink v3 mini and SWD connector of Nucleo-G474RE (connector CN4, but requires to remove IDD jumper for external target).

[![enter image description here](https://i.stack.imgur.com/97fBK.jpg)](https://i.stack.imgur.com/97fBK.jpg)