3
\$\begingroup\$

We were testing the STM32 on a custom board. We were able to program it through SWD pins and an external ST link.

Unfortunately, we didn't activate the SWD pins in the .ioc file. Now we cannot connect to it and we are not able to erase the board through ST link utility. We tried the solutions offered in this post: STM32 & ST-LINK - Cannot connect to MCU after successful programming

We have USB pins active but no code implemented for it as it was actually just a blink code.

Any suggestions as to how to reset the STM32 chip?

\$\endgroup\$
3
  • \$\begingroup\$ All stm32 MCUs have a built-in [serial] bootloader for programming or option byte config. try that. \$\endgroup\$ Sep 21 '21 at 12:34
  • 1
    \$\begingroup\$ You have to use BOOT pins to start a bootloader at startup. \$\endgroup\$ Sep 21 '21 at 12:38
  • 1
    \$\begingroup\$ It depends on the specific STM32 chip how it can be forced into bootloader mode. Usually, it's pulling BOOT0 high. Details can be found in st.com/resource/en/application_note/… \$\endgroup\$
    – Codo
    Sep 21 '21 at 12:42
2
\$\begingroup\$

You can connect under reset. The chip will then place all pins in their default state. Which for the SWD pins is... SWD!

Try erasing the code with the STM32CubeProgrammer with connect under reset enabled.

Obviously this requires the reset line to be wired to your ST Link and RDP level 2 must not be active.

\$\endgroup\$
2
  • \$\begingroup\$ Isn't reset always wired to the in-circuit debugger? I thought it was standardized - pin 10 on the standard 2x5 1.27mm connector. Though if the OP didn't route that signal to /reset, then there will be problems of course. \$\endgroup\$
    – Lundin
    Sep 21 '21 at 14:19
  • \$\begingroup\$ @Lundin No, SWD does not require default. I always route it to the connector but put a DNP resistor in series. Only need it on some prototypes, in cases of mistakes like above. \$\endgroup\$
    – Jeroen3
    Sep 21 '21 at 14:21

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.