iMXRT1176 ONOFF short interruption

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

iMXRT1176 ONOFF short interruption

Jump to solution
1,135 Views
achampoux
Contributor I

Hi, 

I'm working with an Embedded Artists uCOM IMXRT1176 board, trying to receive the short duration ONOFF button interruption for graceful shutdown. I can properly power on and get the emergency power off to shut down.

Here is a snippet of my current code:

void SNVS_PULSE_EVENT_IRQHandler(void);
void SNVS_PULSE_EVENT_IRQHandler(void)
{
    // indicate interruption happened 
}

void init(void)
{

// Enable the interruption
SNVS->HPCR |= (1U << SNVS_HPCR_BTN_MASK_SHIFT);

// Clear interruptions
SNVS->LPSR |= (1U << SNVS_LPSR_SPOF_SHIFT);
SNVS->LPSR |= (1U << SNVS_LPSR_EO_SHIFT);
}

I verified that the interrupt flags are properly cleared, and the interruption enabled but I still can't get in SNVS_PULSE_EVENT_IRQHandler(). I figured it from the startup_mimxrt1176_cm4.c file: 

SNVS_PULSE_EVENT_IRQHandler, // 84 : ON-OFF button press shorter than 5 secs (pulse event)

Am I using the right interrupt handler? Am I doing something wrong? Couldn't find an example on this. Using 2.14 version of SDK.

Labels (1)
0 Kudos
Reply
1 Solution
1,115 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @achampoux,

The code on the following post shows how to properly enable the interruption and how to use the handler.

Solved: Re: SNVS_PULSE_EVENT_IRQHandler constantly fires... - NXP Community

Please follow that code and let me know if you are still experiencing the issue at hand.

BR,
Edwin 

View solution in original post

0 Kudos
Reply
2 Replies
1,116 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @achampoux,

The code on the following post shows how to properly enable the interruption and how to use the handler.

Solved: Re: SNVS_PULSE_EVENT_IRQHandler constantly fires... - NXP Community

Please follow that code and let me know if you are still experiencing the issue at hand.

BR,
Edwin 

0 Kudos
Reply
1,100 Views
achampoux
Contributor I

Following this method for initialization worked, I would like to add some patches that where required:

Had to apply this patch in the IRQ for proper clearing of status flags: https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/SNVS-PULSE-EVENT-IRQHandler-constantly-fires/m-p...

And move those outside the condition in the IRQ handler.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2013022%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EiMXRT1176%20ONOFF%20short%20interruption%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2013022%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EI'm%20working%20with%20an%20Embedded%20Artists%20uCOM%20IMXRT1176%20board%2C%20trying%20to%20receive%20the%20short%20duration%20ONOFF%20button%20interruption%20for%20graceful%20shutdown.%20I%20can%20properly%20power%20on%20and%20get%20the%20emergency%20power%20off%20to%20shut%20down.%3C%2FP%3E%3CP%3EHere%20is%20a%20snippet%20of%20my%20current%20code%3A%3C%2FP%3E%3CP%3Evoid%20SNVS_PULSE_EVENT_IRQHandler(void)%3B%3CBR%20%2F%3Evoid%20SNVS_PULSE_EVENT_IRQHandler(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20indicate%20interruption%20happened%26nbsp%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3Evoid%20init(void)%3CBR%20%2F%3E%7B%3C%2FP%3E%3CP%3E%2F%2F%20Enable%20the%20interruption%3CBR%20%2F%3ESNVS-%26gt%3BHPCR%20%7C%3D%20(1U%20%26lt%3B%26lt%3B%20SNVS_HPCR_BTN_MASK_SHIFT)%3B%3C%2FP%3E%3CP%3E%2F%2F%20Clear%20interruptions%3CBR%20%2F%3ESNVS-%26gt%3BLPSR%20%7C%3D%20(1U%20%26lt%3B%26lt%3B%20SNVS_LPSR_SPOF_SHIFT)%3B%3CBR%20%2F%3ESNVS-%26gt%3BLPSR%20%7C%3D%20(1U%20%26lt%3B%26lt%3B%20SNVS_LPSR_EO_SHIFT)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3EI%20verified%20that%20the%20interrupt%20flags%20are%20properly%20cleared%2C%20and%20the%20interruption%20enabled%20but%20I%20still%20can't%20get%20in%26nbsp%3BSNVS_PULSE_EVENT_IRQHandler().%20I%20figured%20it%20from%20the%20startup_mimxrt1176_cm4.c%20file%3A%26nbsp%3B%3C%2FP%3E%3CP%3ESNVS_PULSE_EVENT_IRQHandler%2C%20%2F%2F%2084%20%3A%20ON-OFF%20button%20press%20shorter%20than%205%20secs%20(pulse%20event)%3C%2FP%3E%3CP%3EAm%20I%20using%20the%20right%20interrupt%20handler%3F%20Am%20I%20doing%20something%20wrong%3F%20Couldn't%20find%20an%20example%20on%20this.%20Using%202.14%20version%20of%20SDK.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2013022%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MXRT%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2013729%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20iMXRT1176%20ONOFF%20short%20interruption%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2013729%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EFollowing%20this%20method%20for%20initialization%20worked%2C%20I%20would%20like%20to%20add%20some%20patches%20that%20where%20required%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EHad%20to%20apply%20this%20patch%20in%20the%20IRQ%20for%20proper%20clearing%20of%20status%20flags%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FSNVS-PULSE-EVENT-IRQHandler-constantly-fires%2Fm-p%2F2012336%2Fhighlight%2Ftrue%23M32903%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FSNVS-PULSE-EVENT-IRQHandler-constantly-fires%2Fm-p%2F2012336%2Fhighlight%2Ftrue%23M32903%3C%2FA%3E%3C%2FP%3E%3CP%3EAnd%20move%20those%20outside%20the%20condition%20in%20the%20IRQ%20handler.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2013161%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20iMXRT1176%20ONOFF%20short%20interruption%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2013161%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F224961%22%20target%3D%22_blank%22%3E%40achampoux%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EThe%20code%20on%20the%20following%20post%20shows%20how%20to%20properly%20enable%20the%20interruption%20and%20how%20to%20use%20the%20handler.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs%2FSNVS-PULSE-EVENT-IRQHandler-constantly-fires%2Fm-p%2F1947134%2Fhighlight%2Ftrue%23M31718%22%20target%3D%22_blank%22%3ESolved%3A%20Re%3A%20SNVS_PULSE_EVENT_IRQHandler%20constantly%20fires...%20-%20NXP%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EPlease%20follow%20that%20code%20and%20let%20me%20know%20if%20you%20are%20still%20experiencing%20the%20issue%20at%20hand.%3C%2FP%3E%0A%3CP%3EBR%2C%3CBR%20%2F%3EEdwin%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E