Reuse SWD Pins on STM32F0
I would like to place a user button on PA13 (SWDIO) and PA14 (SWCLK) pins. Reading through the datasheet I find:
- PA13 (SWDIO) has an alternate function as IR_OUT
- PA14 (SWCLK) has an alternate function of USART1_TX or USART2_TX
- Both pins are listed as FT (5V tolerant I/O)
- Both pins have Note 7 which says:
- After reset, these pins are configured as SWDIO and SWCLK alternate functions, and the internal pull-up on SWDIO pin and internal pull-down on SWCLK pin are activated.
I’m thinking that this means that we can use both of these pins for the user interface. I also read in this document that you can regain SWD mode on reconfigured SWD pins if you connect during reset which makes sense to me. We'll want to be able to program our board via SWD so will we be able to do that if our program redefines these pins to GPIO inputs?
I’m thinking that if I use these pins for user input I may need to connect the button to GND (when pushed) for the SWDIO pin but connect the button on SWCLK to Vcc (when pushed) since that will have an internal pull-down on it.
Has anyone successfully done this?
Thanks,
George
