How do you change the configuration of the SWD/GPIO pins on the fly in PSoC6?

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

cross mob
ScKi_1600301
Level 2
Level 2

To reduce power in the PSoC4, there was sample code to change the SWD pins to GPIO Hi-Z when going into deep sleep and changing them back when waking up.  I can't figure out how to do this in the PSoC 6.

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi,

Can you please let us know the MPN (Manufacturing Part Number) of the device that you are using and also if you are using PSoC Creator or ModusToolbox to develop applications for PSoC 6? You can disable the Debug mode in the System tab in the Design Wide Resources file in PSoC Creator and Device Configurator in ModusToolbox.

To change the configuration of the SWD pins to GPIO through code you can use the PDL API - Cy_GPIO_SetHSIOM() with the en_hsiom_sel_t value to be HSIOM_SEL_GPIO and then change the drive mode to Analog High-Z using the API - Cy_GPIO_SetDrivemode()

You will still be able to reprogram the device when the SWD pins are changed to GPIO and only the Debug mode will be disabled.

Please refer to this Application Note for more details - PSoC 6 MCU Low-Power Modes and Power Reduction Techniques

Thanks and Regards,

Rakshith M B

Edit: Added information about HSIOM

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
3 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi,

Can you please let us know the MPN (Manufacturing Part Number) of the device that you are using and also if you are using PSoC Creator or ModusToolbox to develop applications for PSoC 6? You can disable the Debug mode in the System tab in the Design Wide Resources file in PSoC Creator and Device Configurator in ModusToolbox.

To change the configuration of the SWD pins to GPIO through code you can use the PDL API - Cy_GPIO_SetHSIOM() with the en_hsiom_sel_t value to be HSIOM_SEL_GPIO and then change the drive mode to Analog High-Z using the API - Cy_GPIO_SetDrivemode()

You will still be able to reprogram the device when the SWD pins are changed to GPIO and only the Debug mode will be disabled.

Please refer to this Application Note for more details - PSoC 6 MCU Low-Power Modes and Power Reduction Techniques

Thanks and Regards,

Rakshith M B

Edit: Added information about HSIOM

Thanks and Regards,
Rakshith M B
0 Likes

Rakshith M B,

CY8C6336BZI-BLF03 with PSoC Creator 4.3.

I want the pins to be in debug mode by default in the System tab.

I want to change them to GPIO only during deep sleep.

I was trying to figure out how to do it with Cy_GPIO_SetHSIOM() and was hoping there were #defines for SWD_CLK and SWD_DATA.  For this part, I guess I'll need to use GPIO_PRT6 and the appropriate pin number.

0 Likes

Hi ScKi_1600301​,

You can follow the code snippet provided in the PDL API Reference Manual -

pastedImage_0.png

Regards,

Rakshith

Thanks and Regards,
Rakshith M B
0 Likes