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

XMC™ Forum Discussions

mrnoone
Level 2
5 replies posted 5 questions asked First like given
Level 2

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 50 likes received 250 sign-ins 250 replies posted
Moderator

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 50 likes received 250 sign-ins 250 replies posted
Moderator

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
5 replies posted 5 questions asked First like given
Level 2

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