2020-10-25 06:45 AM
Hi everyone,
I do have 2 PCB boards based on STM32F030F4P6 MCU, the two PCBs have the same hardware and connection with other components, I read the first MCU's code using ST-LInk V2 -using SWD- and saved the .hex file to my PC then I wanted to re-program the other one with the same code, the programming proccess works well and the ST Link utility says that it success but when trying to run the code it says "unable to run"
what shall I do to correctly copy the same code? I program the flash memory and make sure that the Option Bytes are the same, what else must be copied to let the MCU work?
Thanks in advance.
Solved! Go to Solution.
2020-10-27 01:09 PM
I guess that I got my problem, so my question will be: how to correctly read the whole flash memory? as I was trying to read it following the program's default settings (address : 0x08000000 and size : 0x400), I've tried to read from 0x0 up to 0x10000000 just to try getting the whole size but the program says: Error: Data read failed.
2020-10-25 06:55 AM
Copying the flash and option bytes is all you need to do. Do you have a screenshot of the "unable to run" message? You could try STM32CubeProgrammer instead.
2020-10-25 06:59 AM
Thanks for your reply, here is a screenshot
why do you prefer to use STM32CubeProgrammer? shall I also read the flash memory again with it?
2020-10-25 07:15 AM
I've tried STM32CubeProgrammer and when program it it says "Core is locked up"
2020-10-25 07:33 AM
Well the ST-LINK Utilities have been deprecated, most development efforts focus on the STM32 Cube Programmer
Are these boards you designed, or are you trying to copy someone else's? Perhaps protected, or keyed on Unique ID or OTP
2020-10-25 07:51 AM
I don't see a screenshot in your post.
STM32CubeProgrammer is newer and better supported. They do the same job, so sometimes one works and one doesn't. For older chips though, both should work. Easy enough to test.
There are a few hits online for "core is locked up" but no clear solution. Maybe decrease the clock speed.
If the flash is programmed, you shouldn't need anything to run the code. Just remove the ST-Link and power cycle the chip.
2020-10-25 07:52 AM
No they are someone else's design both, I am trying to reverse engineering it.
but I guess they aren't protected as I can read the flash memory, option bytes and CPU information.
but what do you mean by Unique ID or OTP? can I read the first one's and change them for the other?
2020-10-25 11:06 AM
2020-10-27 12:22 PM
@TDK I worked for two days trying to find any way to solve my problem, I've opened another board trying to program it but the same thing happened to me :(
Please if you can help me I can tell you what I do step by step.
Thanks
2020-10-27 12:57 PM
I'm not sure what "Run" in that box is supposed to do. Without a debugger attached, the chip will run on its own. Within STM32CubeIDE, you can also run the code. You don't need to tell the chip to run. Once you provide it power, it will run, assuming it's not halted from the debugger or in reset.