Hi.
I made a custom PCB with a MKE02Z32VLD2 (44 pins), and I need to use SWD_CLK and SWD_DIO as GPIO, which are PTC4 and PTA4 respectively.
The MCU halts at power-up. If I left unconnected PTC4, the MCU works perfectly, so I suspect the problem is a transient while power-up sequence, which produce noise on PTC4 before enable PTA4 and PTC4 as GPIO with the next code:
SIM->SOPT &= ~(uint32_t)SIM_SOPT_SWDE_MASK;
MCU interprets this as a failed attempt to connect the debugger, and because that MCU halts.
The problem is really I don’t know how to fix it. Before this, I had another issue like this with PTB4 pin, which behaves as NMI by default but I needed to us it as GPIO. MCU halted, so I found the solution in the next topic:
But in my case, I have no idea how to fix this issue. Anyone could help me, please?
Thanks.