Hello All,
The BIT description for the FOPT Register is not found in the KE02 Sub-Family Reference Manual .
How can one disable the NMI option at power up?
I have already disabled it in the SIM->SOPT register, but the NMI still fires at Power UP intermittently.
There is a 4.7K Pull UP on the Pin along with a 47nF capacitor.
Thanks,
Satbir
Solved! Go to Solution.
Hi satbir7
To KE0x chip, the NMI can't be disabled during POR. It just can be disabled in SIM->SOPT register, and this register control just can be done in the code.
So, in the POR phase, your NMI pin is still the NMI function, that means, you need to make sure the external NMI pin input signal is high, otherwise, it will influence your MCU boot.
Best Regards,
Kerry
Hi,
I used a way, maybe can help you if you dont disabled NMI interrupt.
But the correct is disable NMI pin in CPU configuration (remember to switch to advanced mode)
and use a external pull-up in this pin, thats is recommended in User Guide.
in Events.c file:
/*
** ===================================================================
** Event : Cpu_OnNMIINT (module Events)
**
** Component : Cpu [MKE02Z64QH2]
*/
/*!
** @brief
** This event is called when the Non maskable interrupt had
** occurred. This event is automatically enabled when the [NMI
** interrupt] property is set to 'Enabled'.
*/
/* ===================================================================*/
void Cpu_OnNMIINT(void) {
/* Write your code here ... */
SIM_SOPT = (uint32_t)((SIM_SOPT & (uint32_t)~(uint32_t)(
SIM_SOPT_CLKOE_MASK |
SIM_SOPT_NMIE_MASK
)) | (uint32_t)(
SIM_SOPT_RSTPE_MASK
));
}
Hi satbir7
To KE0x chip, the NMI can't be disabled during POR. It just can be disabled in SIM->SOPT register, and this register control just can be done in the code.
So, in the POR phase, your NMI pin is still the NMI function, that means, you need to make sure the external NMI pin input signal is high, otherwise, it will influence your MCU boot.
Best Regards,
Kerry
You are welcome!
Any new questions in the future, welcome to create the new question post.
Best Regards,
Kerry
Hello @ErichStyger !
Thank you so much for replying to this post.
Before posting here I was doing some research and found your page that you linked.
Very helpful information, but I am afraid it does not apply to my situation.
I almost Secured the MCU, but luckily it only enabled the Flash Protection.
The MCU you have mentioned in that example has the FOPT register at different address than the one I am using.
May be the NXP's documentation department can shed some light on it.
Thanks,
Satbir
Hi @satbir7 ,
what I usually do in such situations is checking the code in Processor Expert.
See https://mcuoneclipse.com/2014/04/18/pin-muxing-using-the-nmi-pin-as-gpio-pin/
KE02 is supported (e.g. in Kinetis Design Studio): there is a setting to disable the NMI:
It seems that indeed this does not change the NV_FOPT and the bits remain all 1:
But what it does it changes the SIM_SOPT:
Because I don't have a KE device I'm not able to test it. I have attached the project I have generated with Processor Expert for you.
I hope this helps,
Erich
Hi @satbir7 ,
indeed, the FOPT description is very minimal:
taken from the RM here:
If it follows other Kinetis devices (not sure), then it is a mirror of the SIM_SOPT:
I don't have a KE, but for all the Kinetis devices I use I have to configure and store the FOPT in the boot/flash configuration configuration area, see https://mcuoneclipse.com/2020/06/09/disabling-nmi-non-maskable-interrupt-pin/
I hope this helps,
Erich