2025-08-07 5:22 AM - last edited on 2025-08-07 7:01 AM by Andrew Neil
Originally a comment on this Knowledge Base article - moved to main forum for better visibility & easier discussion
Problem: Hi I am facing somewhat similar issue I have used the SWDIO Pin as Timer Channel to toggle GPIO I can see the toggling of GPIO on oscilloscope but cannot go to the debug mode for the same stm32 cube ide project and also for different project where I have kept the debug PINS (SWDIO and SWDCLK) settings as it is
I am trying to erase firmware on Cube programmer l but can't connect my device in their as well. I have Checked the hardware connections and supplies they are fine plus I am also seeing the GPIO toggle.
I want to erase the chip firmware so I can start new on my PCB where I can keep the debug pins settings as default.
2025-08-07 5:38 AM
2025-08-07 6:05 AM
Thank you for you response chandruR but it seems I don't have BOOT0 pin I am using STM32WB05KZ Controller I have checked all 32 pin description.
2025-08-07 7:06 AM
@Shripad_Kulkarni wrote:I have used the SWDIO Pin as Timer Channel to toggle GPIO
Clearly, that's going to stop it working as SWDIO.
Without SWDIO, the debug connection cannot work.
So it's not surprising that this caused problems!
As described in the article, you need to use 'Connect under reset'.
This means that the ST-Link will hold the target in reset while it connects - thus preventing your code from running and reconfiguring the SWDIO pin.
Having done that, you can then erase the chip, and program code which doesn't have this problem.
If you really feel that you must "hijack" SWDIO, then make sure you provide some means for you to be able to reliably connect the debugger.
But I would strongly suggest that you just leave SWDIO (and SWCLK) alone - thus avoiding the problem in the first place!