Cannot connect to STM32 after programming without activating SWD pins

microcontrollerst-linkstm32swd

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?

Best Answer

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.