0
\$\begingroup\$

I bought a generic ST Link online, hooked it up to my target correctly (using SWDIO, SWCLK, GND, and RST), and tried to Target => Connect in the STM32 ST-LINK Utility, and got an error connecting (Can not connect to target). I know that this works on my target board, because with using an STM32 Discovery kit as an SWD programmer works without an issue. I've read a handful of other question on the site, and this one convinced me to trying to manually engage the reset before an operation and I have gotten a response by doing that, but it's pretty much useless if that's what's required.

So what's the deal with these programmers? Do they have crappy reset drivers or what? Feels pretty much useless to me if a manual / externally-timed reset is required. Are there known workarounds, or should I just buy Discovery boards just to use them as programmers?

\$\endgroup\$
  • \$\begingroup\$ Did it come with a manual, datasheet or way to ask for support? If not, sounds like not worth it, the original ST-links are not that expensive. But for the actual problem, I never connect the reset pin, just GND, SWDIO, SWCLK, and 3V3 because the original ST-link needs supply voltage from target for reference. Did you try that? \$\endgroup\$ – Justme Jan 12 at 20:16
3
\$\begingroup\$

I had the same problem! If you take a look at the PCB you see the NRST signal is messed up, meaning it is not connected to PB0 of the stm32F103 MCU in the programmer - instead it is connected to the "other side"(interestingly to a totally mirrored position of the MCU).

What I have done:

Removed the resistor R18 which connects the NRST connector pin to the wrong pin on the MCU. Then with a simple resistor 10R-100R I connected to NRST connector pin to the PB0 of the MCU (number 18 of the QFP 48).

After all, it woks just fine, for Trace support the SWO pin should be wired too You have to follow: https://lujji.github.io/blog/stlink-clone-trace/

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

I use this to program STM32's with the CUBE IDE. You need to set it up with OPEN OCD in the debugger, set the frequency to 4MHZ and change the actual ID of it in the config file. Add this to the config file:

# Set CPUTAPID for open-source ST-Link V2
set CPUTAPID 0x2ba01477

For the reset, set it up with a software reset in the debugger settings. You do not need to have the hardware reset pin connected, and if I remember correctly I don't think it's actually connected either way.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ "You need to set it up with OPEN OCD" - why? And what is this 'CPUTAPID' magic number? \$\endgroup\$ – Bruce Abbott Jan 12 at 21:04
  • \$\begingroup\$ The reason for the CPUTAPID is that the programmer you bought is an open-source "copy" if you will. For some reason it has a different ID than the original one. Therefore the ID is somehow 0x2.... instead of 0x1... \$\endgroup\$ – C. K. Jan 12 at 21:12
  • \$\begingroup\$ I have an ST-link clone like that, but I have never used it. How do I know what ID to use? (will 0x2ba01477 work or could it be something different?) Why must I use OPEN OCD? \$\endgroup\$ – Bruce Abbott Jan 12 at 21:18
  • \$\begingroup\$ It's the way I learned it and the only way I got it to work. If you can make it work in another way I don't know. The 0x2ba01477 should work for all of the clones. \$\endgroup\$ – C. K. Jan 12 at 21:25
  • \$\begingroup\$ @C.K. AFAIK, CPUTAPID is the id of the target MCU (specifically, JTAG IDCODE register), it has nothing to do with the programmer's origin. 0x2ba01477 is an id of the Chinese clones of F1-F4 series \$\endgroup\$ – Maple Jan 12 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.