cancel
Showing results for 
Search instead for 
Did you mean: 

How to use serial wire debug pins after programming the stm32

Tommino
Senior

Hi,

I am using the serial wire debug SWDIO and SWCLK on PA13 and PA14 to program an stm32g031. Can I use these pin after the debug? If yes, do I have to modify some dedicated register (in addition to the GPIO registers) to use thiese pins as GPIO?

4 REPLIES 4

> Can I use these pin after the debug?

Yes.

> do I have to modify some dedicated register (in addition to the GPIO registers) to use thiese pins as GPIO?

In 'G0, AFAIK, no.

Note, that if you also use the NRST pin as GPIO, the chip can't be programmed anymore.

JW

I think the trick with the G0/NRST would be to have a) some dwell time between start-up and reconfiguring the pins, or b) some use case controlled method of resetting or deconfiguring pins, say via a command on serial port.

Perhaps use a button inputs?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi @Community member​ and @Community member​ 

I am not interested in using the NRST pin as GPIO but only the PA13 and PA14 as GPIO

So your opinions are that I should simply code them as GPIO without any other cautions? Neither on the debug side?

What I found in the manual does not help me a lot. Can you take a look at this?

0693W00000UnhEEQAZ.png0693W00000UnhDlQAJ.png

I don't have first-hand experience with 'G0 in particular, but this is what I did/do in other small-pin-count models, .eg. 'F0 and 'L0.

JW