MK22 is not executing the code after powered on, Code only execute after we perform hard reset.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MK22 is not executing the code after powered on, Code only execute after we perform hard reset.

Jump to solution
753 Views
Karthikpr
Contributor I

Hello,

We are currently using the MK22FN512VLH12 MCU in one of our IoT products. Our system involves an MK22FN512VLH12 MCU and an EG-25 4G Module. However, we have encountered an issue where the microcontroller does not run the code after powering on and only runs after we perform an MCU reset. We communicate with the EG-25 via the UART protocol.

We connected the EG-25 STATUS pin to the GPIO PTA4 of the microcontroller and added a 10k pull-up resistor to the STATUS pin. Unfortunately, we discovered that after connecting the STATUS pin to the MCU, the code no longer runs after powering on, and only runs after we perform an MCU reset. We were only able to successfully run the code after physically disconnecting (Track Cut) the EG-25 STATUS pin from the MCU GPIO pin. We are only facing the issue after connecting the STATUS pin to the MCU.

What could be the problem with that GPIO PTA4?

Thanks and Regards,

Karthik P R

0 Kudos
Reply
1 Solution
714 Views
ErichStyger
Specialist I

Hi @Karthikpr ,

The NMI pin and functionality is really a hardware feature and has nothing to do with any RTOS, including the mbed OS. Think about NMI like a reset, where (as with reset) you can have a pin muxed to it or not. With the exception that NMI raises its own exception handler. If you are not using the NMI pin for the NMI interrupt, you can disable the NMI function and mux it as a normal GPIO pin instead, as shown in my article.

I hope this helps,

Erich

View solution in original post

3 Replies
716 Views
Karthikpr
Contributor I

Hi Erich Styger,

I wanted to thank you for your valuable suggestion. We have followed your advice and left the pin unconnected. Instead, we used another GPIO for the STATUS pin of the EG25, which has resolved our issue. I also wanted to ask if disabling the NMI would cause any other issues for our application. Just to give you some context, we are using Mbed RTOS in our application.

Thanks and Regards

Karthik P R

 

0 Kudos
Reply
715 Views
ErichStyger
Specialist I

Hi @Karthikpr ,

The NMI pin and functionality is really a hardware feature and has nothing to do with any RTOS, including the mbed OS. Think about NMI like a reset, where (as with reset) you can have a pin muxed to it or not. With the exception that NMI raises its own exception handler. If you are not using the NMI pin for the NMI interrupt, you can disable the NMI function and mux it as a normal GPIO pin instead, as shown in my article.

I hope this helps,

Erich

746 Views
ErichStyger
Specialist I

The PTA4 pin is the NMI pin. Your pull-up seems not to pull it up fast enough, so the CPU enters the NMI interrupt. I wrote an article about this here:

https://mcuoneclipse.com/2020/06/09/disabling-nmi-non-maskable-interrupt-pin/

 

Otherwise: check the EzPort too: https://mcuoneclipse.com/2016/12/22/disabling-ezport-on-nxp-kinetis-to-solve-power-on-issues/

 

I hope this helps,

Erich