Using SWD pins as general purpose outputs on XMC1202

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
mrnoone
Level 2
Level 2
10 sign-ins 5 replies posted 5 questions asked

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.

0 Likes
1 Solution
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @mrnoone,

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?

You may use the XMC_GPIO_Init() API to initialize the SWD pin as GPIO.

It should be noted that debug functionality cannot be used when SWD lines are configured as GPIOs.

Regards,
Nikhil

View solution in original post

0 Likes
3 Replies
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @mrnoone,

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?

You may use the XMC_GPIO_Init() API to initialize the SWD pin as GPIO.

It should be noted that debug functionality cannot be used when SWD lines are configured as GPIOs.

Regards,
Nikhil

0 Likes
mrnoone
Level 2
Level 2
10 sign-ins 5 replies posted 5 questions asked

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,
};

XMC_GPIO_Init(P0_14, &swd_port_output_config);

XMC_GPIO_Init(P0_15, &swd_port_output_config);

but it does not work and I do not know what is the problem!

 

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi,

This discussion is continued in the following thread: https://community.infineon.com/t5/XMC/Configuring-SWD-pins-as-general-purpose-outputs-in-XMC1202/td-...

Regards,
Nikhil

0 Likes