Wake up from VLLS3 by NMI in K82

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

Wake up from VLLS3 by NMI in K82

2,806 Views
EugeneHiihtaja
Senior Contributor I

Hi !

I'm using power manager example for K82 and wakeup ( via reboot ) from VLLS3  low power mode work properly by using GPIO pin.

NMI pin is also can be used for wake up , if it configured as NMI by using Config Tool.

I can see NMI wake up MCU but execution flow is not go in similar way as some pin configured for useing LLWU controller.

How to organize clean up flow in NMI interrupt handler in case usage of it for wakeup MCU from VLLSx modes ?

Also if I press NMI button on FRDM-K82 evaluation board, I can see at list 10-15 calls of NMI handler.

How-to supress "button drizzling" on this pin ? What can be configured for this pin ?

SW3 button is able to react on rising or falling edge but NMI always generate a lot of noise.

Regards,

Eugene

Labels (1)
Tags (2)
0 Kudos
Reply
6 Replies

2,614 Views
EugeneHiihtaja
Senior Contributor I

Hi Kerry !

I just activate NMI pin via ConfigTool, put device to VLLS3 mode as usually and press button NMI on eval board.

This is code from pin_mux.c what is used to activate pin as NMI and some filters is set for fun.

/* PORTA4 (pin 40) is configured as NMI_b */
PORT_SetPinMux(PORTA, 4U, kPORT_MuxAlt7);

PORTA->PCR[4] = ((PORTA->PCR[4] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_PFE_MASK | PORT_PCR_ODE_MASK | PORT_PCR_ISF_MASK)))

/* Passive Filter Enable: Passive input filter is enabled on the corresponding pin, if the
* pin is configured as a digital input.
* Refer to the device data sheet for filter characteristics. */
| PORT_PCR_PFE(kPORT_PassiveFilterEnable)

/* Open Drain Enable: Open drain output is enabled on the corresponding pin, if the pin is
* configured as a digital output. */
| PORT_PCR_ODE(kPORT_OpenDrainEnable));

Regards,

Eugene

0 Kudos
Reply

2,614 Views
EugeneHiihtaja
Senior Contributor I

Hi Kerry !

I have put return to empty NMI interrupt handler but it dosn't help. MCU wakeup and start to consume power as usually.

But execution flow is not reach main(). And it start to be interesting how-to handle this case.

A4 can be used and C6 and LPTIMER0 work for wakeup well.

But what about NMI wotkflow ? What is problems can be here ?

Regards,

Eugene

0 Kudos
Reply

2,614 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Eugene,

   Please share your test project which can reproduce the problem to me, I will also test it on my side when I have time.


Have a great day,
kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

2,614 Views
EugeneHiihtaja
Senior Contributor I

Hi !

 Wake up via reset by using PTC6 works as expected with enablers from example.

But in case of NMI, MCU starts to consume power e.g wakeup happens, but main() function is not called.

NMI interrupt handler is populated in own source code. It is just empty.

So, it is exists some trick when after NMI wakeup, execution flow should reach main() as usually.

Also , how-to detect if this warm reboot due NMI wakeup ?

Regards,

Eugene

0 Kudos
Reply

2,614 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Eugene,

  Do you write the NMI ISR function? You can add :

 return;

 In the NMI interrupt handler, then try it again.

 About the NMI interrupt detect, you can set a flag in the NMI interrupt handler.

But, could you tell me why you need to use the NMI interrupt to wake up the chip? I think maybe you can use the LLWU module to wake up the chip, it will be more easy to control. NMI pin also can be configured as PTA4, PTA4 pin also the LLWU pin.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

2,614 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Eugene,

   Yes,  in VLLSx mode, this low power mode can be waked up by the LLWU pin, NMI and Reset pin.

pastedImage_1.png

The Vllsx wake up will have the wakeup reset.

About the NMI, you don't need to do the clean up, it doesn't like the PORT interrupt.

About the "button drizzling" , you can do the hardware debounce, add an external capacitor, like this picture:

pastedImage_2.png

You can't do the software debounce, because when the chip detect the NMI reset, the chip will be waked up.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply