This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0L1303: best practice when using SWD pin as GPIO yet still keep the debug access.

Part Number: MSPM0L1303
Other Parts Discussed in Thread: SYSCONFIG, UNIFLASH

I did the same thing as this guy: disable the SWD pin, and lose programming access to the MCU

MSPM0L1304: re-gain debug access via NRST - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

So there is still no way to recover the MCU if I do not have bootloader and disable SWD access from the start?

As I have limited board to play with, I think Yuhao Zhao's number 2 solution sounds pretty great.(add a delay before disabling SWD access)

Could you please help me to check that this is the correct thing to do, or is there anything i missed?:

1. in sysconfig, leave the "Debug Enable On SWD Pins" ticked. do not initialize the intended gpio pin

2. in main, use delay_cycles(??)  to delay for a few second

3. use code below to disable debug

SYSCTL->SOCLOCK.SWDCFG = (SYSCTL_SWDCFG_KEY_VALUE | SYSCTL_SWDCFG_DISABLE_TRUE);

4. initialize the intended gpio pin

Thank you very much