AnsweredAssumed Answered

How to disable MKL03Z NMI on start up- I tried changing FOPT register in the start up file

Question asked by Mrudhul Krishnamurthy on Aug 6, 2017
Latest reply on Aug 12, 2019 by James Morrison



The NXP - MKL03Z32VFK4 chip is experiencing a strange behaviour during boot-up due to the NMI pin being used as a peripheral.


PTB5 (Port B Pin 5) on the M0 chip has NMI activated as default (as mentioned in the data sheet). This pin needs to be used as a peripheral input to the ADC (ADC0_SE1), but while booting up the NMI is always triggered and the code execution gets stuck in the NMI handler. This is condition is true when using a debugger or while just running.


The NMI was disabled by changing the FOPT register in the startup file from 0x3F to 0x3B, as indicated in the reference manual.


After this change:
1. The NMI does not trigger while starting up
2. The system takes about 5 seconds to start (i.e for the execution to enter the main function) - This is a random condition, does not occur always.
3. When the above condition occurs LPUART Tx Rx does not happen.


Is there any way to disable the NMI function on the M0 chip or atleast make sure the NMI does not trigger before changing the PIN MUX to enable the ADC function on the pin?


I am using the Segger j-link base version for debugging and Keil IDE for development. I have also attached the .s file that I am using at the moment.


Thanks in advance,