Hello Gaston Schelotto:
The KE02Z is probably halted due to the NMI interrupt being triggered. Ideally the pin should not have a low level voltage at reset or Power-ON, but if this cannot be avoided the workarounds you can try are:
1) Disable the NMI function by writing 0 to SIM_SOPT[NMIE] bit before configuring the pin as GPIO. This is a write-once bit, so make sure that the startup code is not writing to this register before your code to disable NMI.
2) Define a handler for the NMI interrupt vector and disable the NMI functionality in the function. Something like this:
void NMI_Handler (void)
{
SIM -> SOPT &= ~(SIM_SOPT_NMIE_MASK);
}
Do not forget to add this function to the vector table. The table definition is slightly different depending on your toolchain (CodeWarrior, KDS, IAR).
Let me know if you have issues.
Best regards,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------