EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: Yansi on November 17, 2014, 07:12:10 pm

Title: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 17, 2014, 07:12:10 pm
Hi, I just want to share experience with STLINK/V1 reapir.  If you fry your STLINK, there is a possibility to get it repaired. One way to do it is to replace the chip by another one, by cannibalizing a discovery board. But wait, there is a catch. STLINK V1 and V2 differs in hardware. Luckily, not much. There is some work to be done, so one can use STLINK V2 firmware for STLINK V1 hardware. Today, I have repaired old STLINK V1 and I'd like to share my experience with you:

After removing the chip and soldering the good one, you might want  to download a code to it. The unpopulated conector near the MCU has all pins needed for that. You don't need to solder wires to the tiny fine legs. If you have already soldered pre-loaded (cannibalized) chip, just follow the next steps:
STLINKV2 has got some resistor for version (or something) identification. These resitors (there are actually two) weren't used on STLINK1. You must solder one resitor, 10K from pin 2 (PC13) to ground. Without this resistor, it absolutely denies to work.
Nex, you must add 100ohm resistor between pin 25 (PB12) and 27 (PB14). STLINKV1 hasn't got any. Without this resistor, it also does not work. It looks like, without this resistor (PB12 left open) it fails to read data from SWDIO line. SWDIO just does not switch to input state and the two pins (STLINK and target MCU) begin fight. Fortunately, there is a protection resistor soldered on STLINK, so nothing will make smoke (I hope).
Third difference is the RESET pin connection. On STLINKV1, reset pin was 19 (PB1).  STLINK V2 has reset on pin 18 (PB0). Don't forget that, otherwise "connect under reset" will not work. There is an easy solution, no need to peel and wire any traces on the PCB - just use pin 3 (TRST) instead of 15 (RESET) on the 20pin header connector.

Note: If you repair a board, which has failed by overvoltage, please check and measure ALL protection circuitry near the 20pin header connector, though the parts (especially) resistors don't look fucked, they might be open. I had to change four of them, only one was visibly charred.

Have a nice day, I hope, it will help someone someday, bcs I've lost half a day on this sucker  >:D

One photo of the botch repair:
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: chickenHeadKnob on November 18, 2014, 08:31:40 am
o
Have a nice day, I hope, it will help someone someday, bcs I've lost half a day on this sucker  >:D



I don't see the point in repairing an old st-link1. You can buy a new nucleo dev board for about 10-12 $ and solder an external header to the holes provided. You can even seperate from the target board if you want the jtag alone.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Kjelt on November 18, 2014, 09:27:24 am
Sure and you can buy a new STLINK v2 for $20 as well. But that is not the point is it? Or nobody would repair their old electronics anymore.
It is a hobby and why throw something away that can be repaired.
Nice job.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: chickenHeadKnob on November 18, 2014, 09:50:49 am
Sure and you can buy a new STLINK v2 for $20 as well. But that is not the point is it? Or nobody would repair their old electronics anymore.
It is a hobby and why throw something away that can be repaired.
Nice job.

He canabalized! a working stlink2 to fix a borken stlink1.   .......  :palm:
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: neslekkim on November 18, 2014, 10:25:15 am
If you have an working STlink/v2, why do you need an Stlink/v1?
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: halexa on November 18, 2014, 10:50:02 am
And there is no working windows 7 drivers for STLINK V1, which got me to ditch my V1 and buy a new V2.
SoI don't see  the need for a V1 STLINK, functional or broken.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 18, 2014, 11:28:15 am
Sure and you can buy a new STLINK v2 for $20 as well. But that is not the point is it? Or nobody would repair their old electronics anymore.
It is a hobby and why throw something away that can be repaired.
Nice job.

He canabalized! a working stlink2 to fix a borken stlink1.   .......  :palm:

No, I haven't. :palm:  Just search for the STLINK/V2 code on the web.

neslekkim, halexa: Are you both stupid or cannot read? The modification applies for upgrading STLINK/V1 to V2.  And, also wrong, STLINK V1 works @ Win7 fine. I've used that few times at work. No problems whatsoever (Win7 64bit). 

To be exact, why not to use bare board like NUCLEO board as a programmer: The board has NO isolation,  NO enclosure. Thats why I repaired the old STLINK and upgraded it to V2, because it has a box.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: halexa on November 18, 2014, 11:35:48 am
Srry I got it wrong, then I understand.
Which driver are you using for the V1 on windows 7 64, I never got mine to work and gave up and bought a V2.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: dannyf on November 18, 2014, 11:38:21 am
Quote
The board has NO isolation

Unless yours is an isolation version of the stlink, it doesn't have isolation either.

ST links are a few dollars each, hardly worth the efforts to fix.

The one that's worthy is the newer Jlink - they support Jscope and RTT.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 18, 2014, 12:50:54 pm
:palm: (and maybe double) Bare board lying on conductive surface, so much super for using any discovery/nucleo board as a standalone programmer. Just ideal for shorting out something. ISOLATION  packaging around only solves the problem.

I TALK ABOUT ISOLATION WHICH PROVIDES THO PLASTIC BOX AROUND THE BOARD, not isolation between PC and target. Or am I speaking too much chinese?

Next time I might not share any experience, because some people find it useful only for hassling around.



//halexa: I've installed driver package for STLINK/V2, something also installed with STLINK UTILITY. When I will be at work, I will look what driver is loaded for STLINK V1. Maybe on friday I will be there.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Brutte on November 18, 2014, 01:28:45 pm
I TALK ABOUT ISOLATION WHICH PROVIDES THO PLASTIC BOX AROUND THE BOARD, not isolation between PC and target. Or am I speaking too much chinese?
You are talking Chinese. When someone mentions some dongle provides isolation then in 99.9% cases this does not mean a solitude. Nor putting a dongle in a plastic box.

As for upgrading ST-link from V1 to V2 - please continue but considering the low price of ST-link dongles, I would not count on big audience. Personally I scavenged most stm32F103's from my st-links/V1 and these are used with other projects right now.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 18, 2014, 02:42:14 pm
So ok, I explained that plastic enclosure makes electrical insulation, so please, stop chatting around and keep the topic. If you have not got anything to it, shhhh.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Rasz on November 18, 2014, 04:49:35 pm
hah, I just opened by irl mailbox and found $3.99 chinese STlink2 clone in there :)
http://www.ebay.com/itm/400784973100 (http://www.ebay.com/itm/400784973100)

I was going to bodge one using bare IC and protoboard, but couldnt be bothered when I saw clone prices
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 18, 2014, 10:42:52 pm
Yea, pretty, but this is unlicensed illegal stuff, by the way. STLINK source code (or hex/binary) is not public ware, it is also very strictly kept secret, surprisingly most of ST crew members have absolutely no access to the code/binary.

This decision to repair that crap was simple: Repair and have working unit or wait two months for a chinese version, which is slightly crappy too, because it has absolutely no ESD protection circuitry on the SWD connector. The original STLINK has at least some 5V6 zeners there. (but also lacks ESD protection on USB side)
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 18, 2014, 11:03:25 pm
Very little you say makes sense. You already had a working unit and instead of simply putting it in a box or shrinkwrap you decided to destroy it and spend many hours transplanting and risk ruining both. There is nothing wrong with the $4 chinese clones. They are 100% compatible. They don't take 2 months to arrive and from a practical sense that ESD line is bullshit.  No protection on the USB? LOL.

I've done stupider things myself in the interest of science but having seen two other virtually duplicate blogs elsewhere on the internet I suspect  this is not likely a serious hobby effort.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 19, 2014, 12:16:35 am
No, very little you can understand, because:
I didn't destroy any working unit
I didn't destroy the repaired STLINK (took it home from work, I was allowed to keep it)
I've said, if you are curious enough, you can find pirated STLINK firmware on the web. But i will NOT support anyone getting that firmware.  Just took a fresh 32F103C8T6, soldered it there and programmed it.

And shrinkwrap, so fucking awful I'd better repair and modify the old one I brought home, rather than use that awfuly shrinkwrapped board.

And truly, these days chinese packages go to our country for around 2 months. It pisses me really off, because I think this is a problem with customs in our country, not chinese or any logistic/delivery problem. The package sits at customs quite long time.

Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 01:21:09 am
Hi, I just want to share experience with STLINK/V1 reapir.  If you fry your STLINK, there is a possibility to get it repaired. One way to do it is to replace the chip by another one, by cannibalizing a discovery board.

Actually that is just about the only way to do it.

So now you are saying you downloaded firmware off the internet.  Not likely. Before realizing how protected it was I spent many hours searching and reading stories including the fellow who claimed to have broken the STM encryption. No credible evidence anywhere this has ever been achieved. This is even more ridiculous than the transplant story.

A reasonable course of action would be to order a clone and hobble along with the Discovery until it arrived. Since you avoid revealing you country of origin I assume it's either Antarctica or North Pole. In which case even if it did take 2 months it's unlikely the Discovery would self destruct in that short time. If you are so upset by appearance hide it under the table until the sleek new clone arrives, They are certainly more attractive than those ridiculously clunky STM dongles.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 19, 2014, 01:51:05 am
I have a binary image of STLINK here on my computer, it is just the file from the man who broke the encryption. Before the file was taken away (it is quite some time, the file was given public). ST makes strict legal steps to keep STLINK firmware as a secret. I think that ST's decision is acceptable, with respect to the price of  stlink and the fact, it works as a full featuring swd debugger partially supporting jtag (i think there is restriction of the jtag chain length just for 1 device only).

There are not much possibilities how can I proof you such file exists. If I reveal the filename (by which you can find it on the web), it puts me at risk, because my relation to ST. I can only check if the file is still somewhere on the web. If not, ... ST successfully removed that as well.
I only imagine how the chinese people made their stlink dongles. Also crack or someone wrote whole new software, just compatible?

My country is some small country in central europe, neighbouring with Germany. It doesn't matter. Last week I received maybe 6 packages from last 2 to 3 months and also one, for which I have had full refund. The postman delivered it on friday, after 3 months minus a week from the payment on ebay. The post here really sucks, trust me.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 01:55:30 am
If I reveal the filename (by which you can find it on the web), it puts me at risk

How did I know you were going to say that? LOL.

Two words: peee... emmmm....
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 19, 2014, 01:59:19 am
Maybe.  But now, i am going to sleep, here is 2:59 AM,  shit... >:D
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: dannyf on November 19, 2014, 02:04:55 am
Quote
Before the file was taken away

Quite a few of them are floating around - it doesn't take much to find them.

But what value does it have, when you can get the stlink v2 for less than a song?
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 02:12:40 am
Time to put on the boots. Getting pretty deep, even for dannyf.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 19, 2014, 02:17:49 am
Hey man... just gone over comments below on "the big crackers blog", visited some russion forum and yep, file still there in all its parade, same as I have.

Now really going to sleep.  :=\ :=\ :=\  3:17 AM here.  |O
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 02:26:10 am
For a change of pace try "link" instead of "lame". Just did a search for "the big crackers blog" and nothing about STM but those first two pages sure made me hungry. Mmmmmmm... I'm gonna sign off too to go EAT!
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Kjelt on November 19, 2014, 07:56:04 am
There is nothing wrong with the $4 chinese clones. They are 100% compatible.
That is what they said about the FTDI clones, you can not know for sure and you would not bet a large amount of money on it that it is 100% compatible. So enjoy while it lasts.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: dannyf on November 19, 2014, 11:37:22 am
There are quite a few differences between the clones and the real stlinkv2.

As to ST, I don't think they care much about the clones - they are in the business of selling chips and if the clones help deliver that, they are all too happy.

I suspect that the encryption of the stlink firmware is for reasons of IP rights / licensing.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Kjelt on November 19, 2014, 12:03:41 pm
There are quite a few differences between the clones and the real stlinkv2.
As to ST, I don't think they care much about the clones - they are in the business of selling chips and if the clones help deliver that, they are all too happy.
I suspect that the encryption of the stlink firmware is for reasons of IP rights / licensing.
:-+
Indeed the new STM32 link utility releases also can update the firmware of the genuine STlink. To be compatible with new released chips etc. Can't imagine that these clones will also be properly recognized and updated by the STM32 link utility?
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: dannyf on November 19, 2014, 12:22:49 pm
It is probably hard to tell, given the countless suppliers of those clones.

I did update one clone from J16 to J17, using the ST utility so I think at least some of them are upgradable - not sure how long it will remain that.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Rasz on November 19, 2014, 05:06:19 pm
There is nothing wrong with the $4 chinese clones. They are 100% compatible. They don't take 2 months to arrive

it took over one month for mine to arrive
stlink is nothing fancy, just stm32 on a piece of pcb, kinda hard to get it wrong, even for chinese cloners
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 05:34:36 pm
Hard to get it right if you consider firmware and the total lack of it on the internet. One chinese cloner has done a great job of emulating functionality but is just as protective as STM  over source.

While not common it's not unusual for me to see one month delivery from china. 13 days is the average. Almost always takes 4 days or less to arrive in USA from the time it's shipped but thanks to George Bush and the Patriot Act it will sit for weeks on a shelf at a Homeland Security checkpoint. It never takes 2 months because that's the limit for opening a Paypal case and both the shipper and the government need to avoid that.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: neslekkim on November 19, 2014, 06:54:03 pm
Maybe this is not the correct one, but if it is, it wasn't that hard to find the firmware:
http://www.diygoodies.org.ua/?p=417 (http://www.diygoodies.org.ua/?p=417)
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Rasz on November 19, 2014, 07:38:24 pm
One chinese cloner has done a great job of emulating functionality

umm no, clones use original dumped ST firmware :)
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 08:27:16 pm
What evidence do you have that is true? I contacted over thirty sellers asking for files and only 4 replied but referred me to the same source who wanted big money and no guarantee. He told me it was not original image but clean room source. Mayne just cya but no proof either way.

As far as that " STLinkV2_Firmware.zip" file myself and a friend (independently) tried to build one and ran into the same problem as the only other fellow who tried from the site you linked:

Quote
when trying to update to the newest firmware V2.J19.S4 I get an error: “update error, please ty again”
Any idea ?
Thanx Thomas

Needless to say the OP did not respond. In my case it was with 2 original STM Discovery boards that had been bricked and a scratch built version from the same schematic. I'm going to read Yansi's hardware notes again and give it another try on the off chance something has changed and if it works will eat crow.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Kjelt on November 19, 2014, 08:42:46 pm
And common it is not worth the hassle, you can use any discoveryboard or use the programmer part of it put it in a case whatever,
or just pay the €22 that an original new one costs. That is dirt cheap, it is not like Keil with their €1000 Ulink pro programmers, now that is worth cloning  ;)
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: paulie on November 19, 2014, 09:00:36 pm
Yes, but don't forget the DIY fun factor. Some of us are willing to spend enormous effort and ten times the cost just to reinvent the wheel. Not everybody shares this viewpoint.

There is a practical advantage too. Why wait 2 months :) for a package to arrive from The Evil Empire when you can build one NOW!
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on November 19, 2014, 10:31:11 pm
paulie - EXACTLY, like me speaking in a mirror.   >:D
By reinventing the wheel, one can learn a lot.

Note: I didn't have any problems updating the botched STLINK board. Maybe on first try it fucked up, but then it worked normally. I've tried that FW update a few times to be sure the whole thing works normaly.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: free_electron on November 19, 2014, 11:00:44 pm
chicken egg problem.
 got code , blank chip and broken stlink. how do i flash ?
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: dannyf on November 19, 2014, 11:21:35 pm
Quote
how do i flash ?

Have you heard of "bootloader"?

Surprising that it came from an embedded engineer of your caliber.
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Rasz on November 20, 2014, 06:13:23 am
chicken egg problem.

not with stm32 Grandpa :P can be flashed with ordinary serial terminal
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: mihajlob on December 14, 2015, 04:30:36 pm

i have custom board with stm32f105RB MCU.

could i flash it with STM32VLDISCOVERY board that has st-link (v1) on it?

to simplify my question: can STM32F105RB be programmed/debugged with st-link or i need st-link v2?

Mihajlo
Title: Re: STLINK V1 / V2 difference - when there is need for upgrade/repair
Post by: Yansi on December 14, 2015, 07:20:52 pm
can be debugged with both.