Author Topic: Another use for that old Blue Pill board, turn it into a Stlink programmer.  (Read 8190 times)

0 Members and 2 Guests are viewing this topic.

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Make a Stlink V2 programmer/debugger for STM8/STM32 using a STM32F103 board

Sometimes one needs a SWD programmer/debugger for a STM project but a commercial ‘board’ such as a Discovery, Nucleo or $5 - $20 Chinese clone programmer isn’t available, so it can be handy to build your own or use a cheap spare Blue Pill type board to make one.

The ST MCU may then be flashed and debugged via SWD using this unit. Note, I don’t use STM8 so that facility is untested in this document.

This creates a “V2J37S7 STM8/STM32 Programmer/Debugger”

Note: the following README is for a Unix OS such as Linux on your PC.

https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-stlink-programmer.html
« Last Edit: October 28, 2020, 11:45:06 pm by techman-001 »
 

Offline dave j

  • Regular Contributor
  • *
  • Posts: 172
  • Country: gb
Your link misses the 'l' off the end of html which results in the page not being found.
I'm not David L Jones. Apparently I actually do have to point this out.
 
The following users thanked this post: techman-001

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1915
  • Country: se
Blue Pill can also easily support Black Magic Probe FW, which is also good for MCUs from other vendors.

This has at least the advantage of a clearer license - I do not think installing a cracked FW on non-ST HW is exactly according to the license...
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: nl
Using the ST-Link firmware on non-ST hardware is most likely a violation of the license.  (all those stlink dongles out there, but they're quite convinient)
But to use it, there have been ST-Link bootloaders out there for years,
also, there have been various CMSIS-DAP firmwares out there.

But that is no requirement considering MCUs from other vendors. OpenOCD will work fine with ST-Link and non-ST MCUs.
There have been few exceptions, such as Cypress PSoC4, but using the new stlink-dap implementation (requiring a recent ST-Link firmware though) even those work fine.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5370
  • Country: nl
I quite like the closed aluminum housing with the pinout printed on them of the cheap ST-Link V2 clones.

But I do have some interest in trying out the "Black Magic Probe" some day...
USD 60 for that thing is too much for me, but if it works on a "Blue Pill" I'll look into donating a bit to that project.

 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: nl
Yep, the Black Magic Probe can be compiled for Blue PIlls, and ST-Links as well.

https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware

Their hardware, it's all about having the level shifters and stuff. Important if your target runs on a voltage different then 3.3 Volt.
But if your debugger and target both run on 3.3 Volt, any Blue Pill or Aluminium ST-Link will do.
 


Offline aae30

  • Contributor
  • Posts: 18
  • Country: fi
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #7 on: September 16, 2025, 04:42:34 pm »
Does anyone know of a firmware(stlink compatible?) for bluepills, that would work w/stm8's(==support swim) ?
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15974
  • Country: ch
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #8 on: September 16, 2025, 06:27:14 pm »
Does anyone know of a firmware(stlink compatible?) for bluepills, that would work w/stm8's(==support swim) ?
A genuine STlink V3set is only $35, why even bother trying to cobble one together?
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 2315
  • Country: dk
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #9 on: September 16, 2025, 06:34:49 pm »
Does anyone know of a firmware(stlink compatible?) for bluepills, that would work w/stm8's(==support swim) ?
A genuine STlink V3set is only $35, why even bother trying to cobble one together?

Sometimes Shipping + VAT + Import fees, makes that amount considerably higher.

 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15974
  • Country: ch
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #10 on: September 16, 2025, 06:40:01 pm »
Does anyone know of a firmware(stlink compatible?) for bluepills, that would work w/stm8's(==support swim) ?
A genuine STlink V3set is only $35, why even bother trying to cobble one together?

Sometimes Shipping + VAT + Import fees, makes that amount considerably higher.


So you buy it from a vendor, like Digikey, that offers free shipping and ships DDP incoterms (= VAT and customs prepaid, so no surprises) to your country. (The person who asks has Finland set as their country, and Digikey does have those terms for Finland. The STlink in question costs €31, and the free shipping threshold is €50, so you just order it together with some components for a future project, or with a nucleo board or two.)
 

Offline aae30

  • Contributor
  • Posts: 18
  • Country: fi
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #11 on: September 16, 2025, 09:53:58 pm »
Does anyone know of a firmware(stlink compatible?) for bluepills, that would work w/stm8's(==support swim) ?
A genuine STlink V3set is only $35, why even bother trying to cobble one together?

Got too many unused bluepills(+level shifters+whatever i can imagine this to need) from the past, and already have a stlink v3-set,
which actually kinda* sucks as a tool for the simple stm8's, and one stlink isn't enough - i want one per mcu in my current project.

*) == very much, very fckng much requiring external "loop"-wire to program a target that is powered by a separate power supply.
 

Offline aae30

  • Contributor
  • Posts: 18
  • Country: fi
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #12 on: September 17, 2025, 09:30:25 pm »
No idea how i missed this before asking, but now i've found it, and cobbled first one together for a test in action.
Works for me(the bluepill + 4resistors was all* it took), so i dare suggest this to anyone in need of one for stm8's;

https://github.com/stefaandesmet2003/stlinkswim


*) actually two of them are possibly optional, but i had those anyway so i didn't even try w/o.
 

Offline BadeBhaiya

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: in
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #13 on: September 20, 2025, 12:07:54 pm »
BlackMagicProbe is really cool

A few years ago I had a raspberry pi connected to a bluepill running blackmagicprobe, connected to an STM32L1 board. I setup a system where typing "make flash" on my laptop would compile the code, send the hex file to raspi, and it would be flashed. Then I could use vscode running on my laptop to connect to blackmagicprobe as a GDB server on the raspi, essentially being able to debug from my sofa.

I don't remember the details but it was just a very comfy setup
 

Offline aae30

  • Contributor
  • Posts: 18
  • Country: fi
Re: Another use for that old Blue Pill board, turn it into a Stlink programmer.
« Reply #14 on: September 22, 2025, 07:47:03 pm »
No idea how i missed this before asking, but now i've found it, and cobbled first one together for a test in action.
Works for me(the bluepill + 4resistors was all* it took), so i dare suggest this to anyone in need of one for stm8's;

https://github.com/stefaandesmet2003/stlinkswim


*) actually two of them are possibly optional, but i had those anyway so i didn't even try w/o.

I added usb2uart(a 'VCP' in ST(/microsoft) terms) from another project(github.com/satoshinm/pill_serial) to the stlinkswim,
which can be found from here:
https://github.com/aalm/stlinkswim

Platformio is useless/broken on rpi5/aarch64 :--, so i didn't bother with it, and used the Makefiles from pill_serial instead.

There's still some simple things i want to look at implementing, like possibly dedicating some pins for configuration usable in
cases where bluepill is soldered onboard w/stm8, and stlink interface would be unwanted distraction after initial programming.
Or using a pin to enable MCO output for the stm8 to be programmed, or w/e - plenty of resources left.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->