2025-04-29 6:07 AM - edited 2025-04-29 6:12 AM
Yesterday, I have flashed faulty code to my STM32, and now I can't connect to it via ST-Link or the UART bootloader. I've tried using STM32 ST-Link Utility and STM32CubeProgrammer, but neither works. How can I erase the flash memory? Do I need to buy a new chip?
i using stm32f103c8t6
Solved! Go to Solution.
2025-04-29 6:14 AM
Holding BOOT0 high during reset will let you connect and erase/recover the chip, if it's a genuine ST chip, which it's probably not.
2025-04-29 6:14 AM
Holding BOOT0 high during reset will let you connect and erase/recover the chip, if it's a genuine ST chip, which it's probably not.
2025-04-29 6:39 AM
Welcome to the forum.
Please see How to write your question to maximize your chances to find a solution for best results.
Note that the old ST-Link Utility is long obsolete - STM32CubeProgrammer is the current tool
Are you using a genuine STM32 ?
What board is it on ?
Are you using a genuine ST-Link ?
How are you connecting the ST-Link ?
https://community.st.com/t5/stm32-mcus/how-to-solve-debugger-connection-issues/ta-p/49693
2025-04-29 6:53 AM - last edited on 2025-04-29 6:55 AM by Andrew Neil
I think I'm using a clone STM32 board and a clone ST-Link, but in the past it worked normally. It was only after I uploaded code yesterday that divided a number by zero, and since then the board hasn’t been able to connect. Is there any way to completely erase the code from the chip?
2025-04-29 6:55 AM
By holding BOOT0 high during reset, will I be able to connect via ST-Link or UART?
2025-04-29 7:00 AM
Oh my God, your solution helped me a lot! You're my hero, bro!
2025-04-29 7:01 AM - edited 2025-04-29 7:03 AM
@thequyen831 wrote:I think I'm using a clone STM32 board and a clone ST-Link
You need to check that for sure!
I gave you a link on how to check the ST-Link; in particular, see this part:
Post a link to where you bought the board.
Photos of the board & ST-Link would also help.
Again, please see: How to write your question to maximize your chances to find a solution
@thequyen831 wrote:but in the past it worked normally.
That's the trouble with using clones/fakes: they could have been just barely working before - and have now just gone over the edge.
There are many posts here where many people have wasted many hours on these fakes/clones.
Avoid the hassle - just get a genuine ST board!
eg, NUCLEO-F103RB - which comes complete with a genuine ST-Link.
https://www.st.com/en/evaluation-tools/nucleo-f103rb.html