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:
- BOOTSRC_SEL = 00 (Boot from FLASH),
- FAST_INIT = 1 (Fast Initialization),
- RESET_PIN_CFG = 1 (RESET_b pin is dedicated),
- NMI_DIS = 1 (NMI_b pin/interrupts reset default to enabled),
- BOOTPIN_OPT = 1 ( Boot source configured by FOPT[7:6] ( BOOTSRC_SEL) bits),
- LPBOOT = 11 (Core and system clock divider (OUTDIV1) is 0x0).
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?