Skip to main content
Tommino
Associate III
October 7, 2022
Question

How to use serial wire debug pins after programming the stm32

  • October 7, 2022
  • 2 replies
  • 3604 views

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?

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
October 7, 2022

> 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

Tesla DeLorean
Guru
October 7, 2022

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 VenmoUp vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
October 10, 2022

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