Skip to content

How to Program and Recover Chinese Clone of the st-link v2 and reflash it to segger j-link

Notifications You must be signed in to change notification settings

Zelmoghazy/st-link-v2-clone

Repository files navigation

How to Program and Recover Chinese Clone of the st-link v2

  • My version of the st-link clone is powered by a chinese STM32 Clone called MH2103A CBT6
    • It is supposed to be a pin to pin clone of the STM32F103

  • You need another st-link to flash the one you want to program.
  • Using a multimeter continuity test I was able to figure out the debugging pins
    • I know its tempting to use the ones at the end, but it wont work ! you need to use the debugging pins

  • Since only the SWDIO and SWCLK are really needed you can use the 3.3v and GND from the back.
  • I used regular jumper wires and aligned them carefully with the debugging pins without soldering or anything, it took some getting used to but it would work you just need steady hands and someone to help you, you may need to try a couple of times until it works.

Programming Steps

  • Note : After each step unplug the programmer from the usb and put it again.

1- unlock the flash on device (configuration is included in the repo)

openocd -f interface/stlink-v2.cfg -f .\myconfig.cfg -c "init" -c "halt" -c "stm32f1x unlock 0" -c "shutdown"

2- Erase the flash on device

st-flash erase
  • The st-link power LED will stop working at this stage, dont worry.

3- flash the st-link bootloader

openocd -f interface/stlink-v2.cfg -f .\myconfig.cfg -c "init" -c "halt" -c "flash write_image erase Unprotected-2-1-Bootloader.bin 0x08000000" -c "shutdown"

4- Open included st-link utility version (you need an old version newer versions doesnt work)

5- Use CubeProgrammer to upgrade to latest firmware

Convert ST-Link clone to J-Link

  • Note : This procedure may brick your st-link clone and you would need to reflash it, so it advisable to have 2 st-link clones so if you brick one you can reflash with the other.
  • If you get an error that st-link firmware is unsupported, flash the included firmware backup STLinkV2.J16.S4.bin using the same method described above.

Steps :

  1. Use STLinkReflash (Version 190812)

    • only use this version (included in the repo)
  2. Modify the following offsets in STLinkReflash.exe or use the included prepatched version

    2566 3C > 38

    2567 40 > C0

    26B2 3C > 38

    26B3 4A > C0

  3. Run STLinkReflash.exe and accept, selecting option 1.

SEGGER SystemView

  • SEGGER SystemView can be used with it, I tried it with the Blue Pill and FreeRTOS and it works!.

About

How to Program and Recover Chinese Clone of the st-link v2 and reflash it to segger j-link

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published