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

How could I fix the problem?


  • \$\begingroup\$ Do you have a link to the datasheet? \$\endgroup\$ – jippie Mar 18 '13 at 20:49
  • \$\begingroup\$ 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. \$\endgroup\$ – jippie Mar 18 '13 at 20:50
  • \$\begingroup\$ @jippie, I have attached the datasheet. \$\endgroup\$ – Arturs Vancans Mar 18 '13 at 20:59
  • \$\begingroup\$ Do you know how you managed to do that? Check this document: st.com/st-web-ui/static/active/en/resource/technical/document/… \$\endgroup\$ – jippie Mar 18 '13 at 21:02
  • \$\begingroup\$ I already managed to fix that. Boot0 pin helped. If you want, you can create a post and I will accept it. \$\endgroup\$ – 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.

  • \$\begingroup\$ ie, by means of the UART or USB bootloader... \$\endgroup\$ – 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").


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.