Skip to main content
Associate
July 7, 2025
Solved

Using ST-Link v2 and Utility to read program from STM32F103C8T

  • July 7, 2025
  • 4 replies
  • 923 views

Using ST-Link v2 and Utility I've been trying to read and save a hex file from a EVSE device that uses a STM32F1 microprocessor to control and display functions. I thought that it was just a matter of connecting via the  debug/program interface and then saving the result, but unfortunately I seem to have erased everything and now the memory is displayed as empty.
My experience on this sort of thing is limited so can anyone help and possibly comment on what I'm doing wrong?

Best answer by Karl Yamashita

@ludemon wrote:

Thank you Andrew for your reply.

Yes it is Electric Vehicle Supply Equipment aka Portable EV Charger.

I did get a message saying that read-out protection was enabled so I disabled it in Option Bytes. Is that likely to have caused the problem?

I don't know if the ST-Link is genuine or not, I bought it from an Aliexpress seller. It does seem to be recognized as genuine by the utility.

I have another similar working EVSE which I could attempt to extract the program from using a STM32CubeProgrammer, but from my previous experience and your comment about Intellectual Property I'm reluctant to take the risk.


By disabling the Option byte, you've inevitably erased the firmware in the STM32F1xx.

If the STM32 is code protected, then there is not much you can do to extract the code.  

4 replies

Andrew Neil
Super User
July 7, 2025

Is that "EVSE" as in Electric Vehicle Supply Equipment ?

It's quite likely that the manufacturer will have read-protected the device - ie, their Intellectual Property (IP). 

 

Is it a genuine ST-Link?

Note that the ST-Link Utility has been obsolete for years - the current tool is STM32CubeProgrammer:

https://www.st.com/en/development-tools/stm32cubeprog.html

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ludemonAuthor
Associate
July 7, 2025

Thank you Andrew for your reply.

Yes it is Electric Vehicle Supply Equipment aka Portable EV Charger.

I did get a message saying that read-out protection was enabled so I disabled it in Option Bytes. Is that likely to have caused the problem?

I don't know if the ST-Link is genuine or not, I bought it from an Aliexpress seller. It does seem to be recognized as genuine by the utility.

I have another similar working EVSE which I could attempt to extract the program from using a STM32CubeProgrammer, but from my previous experience and your comment about Intellectual Property I'm reluctant to take the risk.

Karl Yamashita
Karl YamashitaBest answer
Principal
July 7, 2025

@ludemon wrote:

Thank you Andrew for your reply.

Yes it is Electric Vehicle Supply Equipment aka Portable EV Charger.

I did get a message saying that read-out protection was enabled so I disabled it in Option Bytes. Is that likely to have caused the problem?

I don't know if the ST-Link is genuine or not, I bought it from an Aliexpress seller. It does seem to be recognized as genuine by the utility.

I have another similar working EVSE which I could attempt to extract the program from using a STM32CubeProgrammer, but from my previous experience and your comment about Intellectual Property I'm reluctant to take the risk.


By disabling the Option byte, you've inevitably erased the firmware in the STM32F1xx.

If the STM32 is code protected, then there is not much you can do to extract the code.  

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
mƎALLEm
Technical Moderator
July 7, 2025

Hello;

Are you using Blue Pill board?

Post photos of your board and the ST-LINK: bottom and top.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
ludemonAuthor
Associate
July 8, 2025

I'm not using a Blue Pill board. I thought that was for development purposes.

The photo shows my ST-Link connected to the existing board via GND CLK DIO VCC port.

EVSE_STLINK.jpg

mƎALLEm
Technical Moderator
July 8, 2025

That’s unfortunately not a genuine STLINK.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
TDK
Super User
July 8, 2025

> My experience on this sort of thing is limited so can anyone help and possibly comment on what I'm doing wrong?

If you can connect over SWD and view the content of the flash, you can save it to disk. It is straightforward.

Unclear what you did to erase the flash memory, but don't do that. It requires some effort--don't click things randomly.

 

Try STM32CubeProgrammer instead of the ST-Link Utility which is no longer supported.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ludemonAuthor
Associate
July 8, 2025

From what others have said, the fact that I disabled read out protection in Option Bytes caused the flash memory to be erased. Maybe this is more difficult to do in STM32CubeProgrammer with more warnings given, but it seems that if the code is read protected I can't do anything anyway.

Andrew Neil
Super User
July 8, 2025

@ludemon wrote:

 the fact that I disabled read out protection in Option Bytes caused the flash memory to be erased. .


Indeed - that is the documented behaviour.

Think about it: if you could simply bypass the readout protection by just editing the option bytes that wouldn't provide any protection at all - would it?

 


@ludemon wrote:

 it seems that if the code is read protected I can't do anything anyway.


Indeed - that is the whole point of protecting the code!

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
July 9, 2025

It seems that your original question is now answered?

If so, please mark the solution - see:

https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.