2016-04-08 02:55 PM
Can I, used SWD pin, for example on STM32F0, as SWD
when debugging
and flashing MCU and as little used IO ,during normal
operation
? If yes, how?2016-04-08 03:26 PM
In principle, yes, you should be able to.
Without knowing your MCU it's hard to be too specific, but in general the pins used for SWD/JTAG default to AF mode on, AF ID 0. In firmware, you can disable AF mode in the GPIO configuration for those pins using the Mode register. They will then function as normal GPIO. You would need some way to detect the requirement to change from SWD to GPIO mode and/or vice versa, perhaps a button or switch on a different pin.2016-04-08 03:45 PM
You can just reconfigure the pins. Use them for functions you can easily live without while debugging or single stepping, or use other debugging techniques.
The pins would be ideal for LEDs for example, which would not interfere with debug operation in the finished design. The BOOT pin should be usable to stop your code from actually running, and permit download, etc.