I have Kinetis MKL03Z8VFG4 on custom board and trying to setup NMI interrupt handler to handle logic 0 during the boot (i.e. external device is connected to pin PTB5/IRQ_12/NMI_b and pulling to GND). I have setup MWE from SDK 2.x example where FOPT register is beeing set:
__attribute__ ((used,section(".FlashConfig"))) const struct {
unsigned int word1;
unsigned int word2;
unsigned int word3;
unsigned int word4;
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3FFE};
Looking into datasheet my configuration sets:
Then I override default WEAK IRQ handler by defining:
void NMI_Handler(void)
{
LED_RED_ON();delayMS(1000);
// TODO: handle NMI_b pin state
}
..but PC never goes into this function.
Why is NMI_Handler(void) not beeing called, I am missing something?
Hi
NMI_DIS = 1 (NMI_b pin/interrupts reset default to enabled),
is incorrect. A '1' disables the NMI and doesn't enable it.
Regards
Mark
Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html
Kinetis KL02/KL03/KL05:
- http://www.utasker.com/kinetis/FRDM-KL02Z.html
- http://www.utasker.com/kinetis/FRDM-KL03Z.html
- http://www.utasker.com/kinetis/FRDM-KL05Z.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html
Open Source version at https://github.com/uTasker/uTasker-Kinetis
Mark, I still think your answer in incorrect: settings logic '1' to NMI_DIS does enable NMI pin (as opposed to human understanding of the register flag name). More information can be found in:
https://community.nxp.com/message/498526?commentID=498526#comment-498526 (KL02_NMI.pdf)
https://www.nxp.com/docs/en/reference-manual/KL03P24M48SF0RM.pdf (Table 6-2. Flash Option Register (FTFA_FOPT) definition)
BR
Tomaz
You are right that I seem to have made a mistake in my statement since '1' enables the NMI pin and '0' disables it.
These are the definitions that I use:
#define FTFL_FOPT_NMI_DISABLED 0x00
#define FTFL_FOPT_NMI_ENABLED 0x04
Regards
Mark