Hi guys, I'm working in a custom board with the KL25Z64. PTA4 (NMI_b) is configured in my application as output with a pulldown resistor. When I run the app without the bootloader everything works fine, but when used in combination with the bootloader, nothing happens.
I reckon Kboot leaves the NMI_DIS (FOPT register) bit enabled by default, thus triggering the interrupt constantly and never running the main application.
I tried changing the flash configuration in my startup_MKL25Z4.s file from:
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFE
to:
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFF7FE /* Change here */
But it doesn't seem to work.
I also tried adding the NMI handler to my system_MKL25Z4.c and change the pin mode to ALT1 from there. But I'm not even sure if my interrupt handler is being triggered at all!!
void NMI_Handler(void)
{
PORT_BWR_PCR_MUX(PORTA, 4, 1); // Select ALT1
FGPIO_SET_PDDR(PTA, 1 << 4); // Make pin an output
FGPIO_WR_PCOR(PTA, 1 << 4); // Output LOW
}
I'm probably doing something very silly. Any help will be much appreciated.
Regards,
Alex.