DIY ST-Link V2 programmer (SWIM & SWD)

Post Reply
User avatar
Kenjutsu
Posts: 134
Joined: Fri May 29, 2015 8:26 am

DIY ST-Link V2 programmer (SWIM & SWD)

Post by Kenjutsu » Thu Dec 07, 2017 12:30 pm

I have been struggling to reliably use STM32duino under OSX. Serial programming always works 100%, but DFU/bootloader will work well the one day, and then for seemingly no apparent reason, will stop working the next. Even using a BMP is unreliable. All of this I have found is related to OSX.

I did find, however, that the ST-Link v2 programmer on my F411RE Nucleo board always works 100%. This ST-Link programmer cannot, however, program STM8 devices because of the missing SWIM interface. In July of 2016, I also started playing with the cheap STM8 dev boards and needed a SWIM programmer. I was able to successfully built one using a BP (DIY ST-Link SWIM programmer for STM8S?).

I decided to revisit the DIY ST-Link programmer to get both SWIM and SWD working. Here is my crude attempt at a schematic:
SWIMSWDProgrammerUsingPB.png
SWIMSWDProgrammerUsingPB.png (49.24 KiB) Viewed 163 times
and a stripboard layout:
SWIMSWDProgrammerUsingPB_VeeCAD.png
SWIMSWDProgrammerUsingPB_VeeCAD.png (71.28 KiB) Viewed 163 times
and the bill of materials:

Code: Select all

    Item               Value      
      C1                0.1u
      J1                SWIM
      J2                 SWD
    LED1               Green
    LED2                 Red
      R1                 4k7
      R2                 4k7
      R7                 220
      R8                 220
      R9                 220
     R10                 680
     R19                 510
     R20                 510
      U1         STM32F103BP
     VD3                 5V1
     VD4                 5V1
     VD6                 5V1
     VD7                 5V1
I am happy to report that both SWIM and SWD are working as expected with the caveat that for SWD to work correctly NRTS must be connected to the RST pin on the BP under programming.

Yes, it is cheaper to buy a cheap ST-Link clone from China, but I could not wait another 2 months ;)

Hopefully, someone will find this useful, and to OSX user I can strongly recommend getting/building an ST-Link programmer, which in my experience, always works, no matter the mood of your OSX device ;) ;)
Pieter

OSX: 10.12.6
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

ag123
Posts: 799
Joined: Thu Jul 21, 2016 4:24 pm

Re: DIY ST-Link V2 programmer (SWIM & SWD)

Post by ag123 » Fri Dec 08, 2017 4:22 pm

+5 nice :D
are those 5v zener really needed? i havn't looked at any specs or docs though, but my guess is we'd perhaps be able to program another stm32 or stm8s simply connecting the gpio pins? i'm not too sure if the normal 3.3v stm32 gpios would for instance be able to program another BP/MM over SWD or a STM8S over SWIM?

found yet another funky interesting st-link v2 programmer, some details are in chinese though. i'd guess google translate would help
https://github.com/solosky/stlink-uart
and another
http://www.micromouseonline.com/2014/01 ... rogrammer/

Post Reply