cancel
Showing results for 
Search instead for 
Did you mean: 

Debugger & Programmer can't connect after configuring SWDIO as Timer Output

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.

3 REPLIES 3
chandruR
Associate II
Hi Shripad_Kulkarni,
Pull up the Boot0 pin to High and trying to connect the device. It may work for you

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.

Andrew Neil
Super User

@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!

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.