0

I have a custom STM32 CM0 board I spun, and have been programming it using a $2 ST-LINK "clone" programmer.

I needed to test a chip with more memory, so I pulled out an unopened brand new STM32F0-Discovery board.

I connected my clone programmer via SWD (connections are correct, I removed the two jumpers). AND NOTHING.

The Discovery board is working with a USB connection, just not with the SWD. So, the SWD pins are working and didn't get reset.

There's nothing to reset, I just see nothing from this clone programmer connected to this Discovery board.

Does STM have some kind of protection in place in their development boards, that they only work with an official ST-LINK?

I don't care about how the connection is made... Is their a vendor lock with the official tool.

Sounds like some tinfoil hat theory, but I'm sitting here with a clone tool that works on my custom board but not on this development board.

Leroy105
  • 1,837
  • 3
  • 21
  • 34
  • lemme guess USD 2 from ebay, aliexpress, banggood, amazon marketplace? You got ripped off by someone who's selling untested equipment. (Other than that, make sure you've disconnected the on-board SWD programmer – there's usually jumpers that allow you to do that) – Marcus Müller Jan 21 '18 at 21:54
  • Yeah. But it works on another CM0, no problem. It even has the most up-to-date firmware from the ST-LINK utility. I thought they might brick it there. STM seems pretty nice about their dev tools, I kind of figure they wouldn't lock anything out in any case. They want to sell MCUs not dev tools... – Leroy105 Jan 21 '18 at 21:55
  • if the programmer works with other boards, the most likely explanation definitely is that you've got some connections missing (is the board powered?) or duplicate (external clone AND on-board programmer both connected at the same time) connections. SWD is so simple and well-documented that there's no way you can actually include a lockout mechanism – Marcus Müller Jan 21 '18 at 21:57
  • The discovery boards all have an on-board ST-LINK. You should be able to use that the same way you use your little 3rd party one. And you should also be able to use the 3rd party one with the target on the discovery, *if you connect it correctly*. **BEWARE that the pinout for accessing the onboard target may not be as expected** - most instructions will be for using the on-board ST-LINK for an off-board target, what you want is the opposite conceptually but requires different connections. – Chris Stratton Jan 21 '18 at 22:09
  • 1
    You should document the *exact* connections of the programmer and jumper changes which you tried in your question. – Chris Stratton Jan 21 '18 at 22:09
  • 1
    Possible duplicate of [How to Use an External ST-Link/V2 with the STM32F4 Discovery Board](https://electronics.stackexchange.com/questions/182763/how-to-use-an-external-st-link-v2-with-the-stm32f4-discovery-board) - the SWD connections are actually the same for all STM32's so it does not matter which board you have. – Chris Stratton Jan 21 '18 at 22:12
  • 1
    Not a solution, but as an aside only, I have never used clone programmers for any professional work. Especially when they are so cheap to buy. For example, with Microchip I will buy and pay for not just one, but two, copies of their MPLAB REAL-ICE as well as their hobbyist PicKit 2 and 3 devices. I may also buy clones, but only for fun. Never for work. (I have had to design and build and program my own programmers. But only when nothing commercial was available at the time.) This way I know I have someone to call if there is a problem, too. – jonk Jan 21 '18 at 22:13
  • @jonk - in this case the 3rd party version are far more convenient than the official ones as they are very compact little dongles resembling a flash drive. While they can't do everything ST's can, they are also cheap enough to replace when needed, and tiny enough to always have on hand. Since it works with custom boards, the programmer is *not* the problem here. – Chris Stratton Jan 21 '18 at 22:15
  • It's pretty hard to mess up these SWD connections... I'm with you on the official programmers. I was actually surprised this clone worked. – Leroy105 Jan 21 '18 at 22:19
  • @ChrisStratton Thanks for the added information that I wasn't aware of here. Regardless, this leaves one with no one to call. I prefer to pay something to gain access. $500 is cheap (to me) when I'm working on commercial products. – jonk Jan 21 '18 at 22:19
  • Having the tiny $9 solution in my laptop bag even when I think I'm visiting a site to deal with an iOS app / wifi issue is cheap compared to needing to go back to my lab to fetch a programmer when they suddenly ask about an MCU issue. – Chris Stratton Jan 21 '18 at 22:20
  • I have to pull out a scope and see why, but the pins on the header don't seem to work... I tried the external side pins, and it's all good. I'll have to probe it with a scope. No tin foil conspiracy from a vendor... – Leroy105 Jan 21 '18 at 22:21
  • @ChrisStratton Now we are at cross purposes. I don't have your problems about visiting a site, I guess. But I take your point for those who do. – jonk Jan 21 '18 at 22:21
  • @Leroy105 The docs seem pretty solid about how easy it is to do. Just remove those two jumpers, it says. And make sure that you aren't using one of the pins for something external, if I read it right. I can't imagine you messing that up here: [STM32F0 Discovery](http://www.st.com/content/ccc/resource/technical/document/user_manual/30/ae/6e/54/d3/b6/46/17/DM00050135.pdf/files/DM00050135.pdf/jcr:content/translations/en.DM00050135.pdf). – jonk Jan 21 '18 at 22:22

1 Answers1

3

If the programmer works with other boards, the most likely explanation definitely is that you've got some connections missing (is the board powered?) or duplicate (external clone AND on-board programmer both connected at the same time) connections.

SWD is so simple and well-documented that there's no way you can actually include a lockout mechanism. The MCUs are designed to be programmed by any tool that speaks SWD and sends the commands given in the programming manual – STLink v2 actually refers to the protocol you talk between programmer and PC to make the programmer do the right SWD things.

Marcus Müller
  • 88,280
  • 5
  • 131
  • 237
  • Yes, but it may not be immediately obvious how to correctly connect an external programmer. The usual pattern is instead to use the on-board programmer with an external target. As a guess, the external programmer needs to be connected to some of the pins were headers were removed, and also some other pins. Or perhaps it can be connected to the appropriate pins on the target edge headers. – Chris Stratton Jan 21 '18 at 22:11