Hello everyone. I have written a code which uses SWD pins as GPIO, but the code does not work. My question is that Can we use SWD protocol pins (clock and data) which is dedicated for debug purposes as GPIO? If Yes, What is the related setting for using those pins as GPIO in the code?
Thanks for your time.
SWD pins may be used as general purpose IOs, but this change has to be done only after you program your device. Are you following this flow?
It should be noted that debug functionality cannot be used when SWD lines are configured as GPIOs.
Thanks @ncbs for the answer. Yes, it is obvious that it should be after finishing SWD programming.
I have used the following code to init swd pins as gpio:
static XMC_GPIO_CONFIG_t swd_port_output_config =
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
.input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD,
.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW,
but it does not work and I do not know what is the problem!