powering up issue on MKE02Z GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

powering up issue on MKE02Z GPIO

Jump to solution
965 Views
gschelotto
Contributor V

Hi,

I've configured PTB4 as a digital output and 0 value at initialization on MKE02Z64VLH4 (64-pin).

During the KE02Z power up (0 to 5V) I see this behavior on this pin (channel 2):

pic_209_1.gif

There is no problem if I left PTB4 unconnected but in my application this pin drives an opto-coupler (500 ohms in series with the photodiode). This causes a current injection that halts the KE02Z at start-up. How can avoid this issue? I've checked adjacent pins (PTB5 and PTC3) and everything goes well with them. I've also disabled NMI (using PE) with no success. I'll appreciate any help.

regards,

gaston

1 Solution
662 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
663 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
662 Views
gschelotto
Contributor V

Jorge,

I've tried the 2nd workaround and it works well. Now the cpu is not halted at power up!

many thanks,

gaston