powering up issue on MKE02Z GPIO

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

powering up issue on MKE02Z GPIO

ソリューションへジャンプ
1,711件の閲覧回数
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 解決策
1,408件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
1,409件の閲覧回数
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 件の賞賛
返信
1,408件の閲覧回数
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