I overwrote by mistake ST-Link programming pins PA13 and PA14. Now I cannot reprogram my chip.

How could I fix the problem?

Datasheet

• Do you have a link to the datasheet? – jippie Mar 18 '13 at 20:49
• Atmel AVR's can be 'unbricked' using a High Voltage programmer. Don't know if your STM supports something similar, if so it should be described in the datasheet. – jippie Mar 18 '13 at 20:50
• @jippie, I have attached the datasheet. – Arturs Vancans Mar 18 '13 at 20:59
• Do you know how you managed to do that? Check this document: st.com/st-web-ui/static/active/en/resource/technical/document/… – jippie Mar 18 '13 at 21:02
• I already managed to fix that. Boot0 pin helped. If you want, you can create a post and I will accept it. – Arturs Vancans Mar 18 '13 at 21:03

To 'unbrick' STM32F4, connect BOOT0 pin to 3V pin and then you can erase or flash it.

• ie, by means of the UART or USB bootloader... – Chris Stratton Mar 18 '13 at 21:30

I also ran into this problem but due to my circuit, was not able to use the bootloader to recover it.

At first I thought I was hosed, but eventually learned that you can connect via JTAG while the chip is being held in reset. When held in reset, the pins go to their default states and thus the chip can be reprogrammed even if your application remaps them for other uses when it runs.

The OpenOCD command to enable this is:

reset_config srst_only srst_nogate connect_assert_srst


I have heard that ST-Link supports connect-under-reset as well, but I am not familiar with it.

edit: Did a quick search, and it is indeed supported by ST-Link. See UM0892 for details (search for "connect under reset").