SNVS_PULSE_EVENT_IRQHandler constantly fires...

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SNVS_PULSE_EVENT_IRQHandler constantly fires...

跳至解决方案
446 次查看
application_ninja
Contributor III

I want to capture the ONOFF button press, and am enabling SNVS_PULSE_EVENT_IRQn, however the handler constantly fires with HPSR reserved bits in addition to bit 7, the button interrupt I am capturing when the button is pressed.

However this constant firing of the SNVS_PULSE_EVENT_IRQHandler slows the program down, how can I eliminate this?

0 项奖励
回复
1 解答
385 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @application_ninja,

I believe there must be something wrong with your hardware connection of the button. I implemented the code you shared on the EVK, and I only see the handler trigger once. By the way, I don't recommend adding a printf() routine inside of an IRQ Handler: multithreading - C printf() in interrupt handler? - Stack Overflow

BR,
Edwin.

在原帖中查看解决方案

0 项奖励
回复
5 回复数
411 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @application_ninja,

The SNVS_PULSE_EVENT_IRQn only gets triggered by bit 7 of the SNVS_HP Status Register (HPSR). Please make sure your button connection properly made to prevent bouncing issues, and clear the interruption bit between triggers by writing 1 on bit 7 of the HPSR.

BR,
Edwin.

0 项奖励
回复
401 次查看
application_ninja
Contributor III

Thank you for the response, however I am doing this, but the handler is constantly called no matter what. So right after the call to "EnableIRQ( SNVS_PULSE_EVENT_IRQn );", no other statement is executed as the IRQ handler is constantly called with the reserved bits being set, and slowing the program down. Yes, I properly get the button press when pressed, i.e. the statement: "PRINTF( "SNVS_PULSE_EVENT_IRQHandler.\r\n" );" is called only at button press, but the "SNVS_PULSE_EVENT_IRQHandler" is always called constantly.

Code to set / capture IRQ:

 

SNVS_HP_Init( SNVS );


SNVS->HPCR |= SNVS_HPCR_BTN_MASK( 0x01 ); // 1: Interrupt enabled
SNVS->HPCR |= SNVS_HPCR_BTN_CONFIG( 0x02 ); // 010: Button signal is active on the falling edge


EnableIRQ( SNVS_PULSE_EVENT_IRQn );

 

 

Handler code:

void SNVS_PULSE_EVENT_IRQHandler(void)
{
     if( ( SNVS_HP_GetStatusFlags( SNVS ) & SNVS_HPSR_BI_MASK ) != 0U )
     {
          PRINTF( "SNVS_PULSE_EVENT_IRQHandler.\r\n" );

          SNVS_HP_ClearStatusFlags( SNVS, SNVS_HPSR_BI_MASK );
     }

     SDK_ISR_EXIT_BARRIER;

}

 

0 项奖励
回复
386 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @application_ninja,

I believe there must be something wrong with your hardware connection of the button. I implemented the code you shared on the EVK, and I only see the handler trigger once. By the way, I don't recommend adding a printf() routine inside of an IRQ Handler: multithreading - C printf() in interrupt handler? - Stack Overflow

BR,
Edwin.

0 项奖励
回复
360 次查看
application_ninja
Contributor III

I have verified with the EVKB board, and no problem exists, so we must have a problem with our hardware. Thank you for your support on this.

0 项奖励
回复
381 次查看
application_ninja
Contributor III

Sure, I know printf’s are not to be used, this is just debug/test code.

I thought I had tested this same code on the EVKB board with the same results, I.e. multiple Irq firings, but can test again.

could you share your test project so I can make sure I’m testing apples to apples?

0 项奖励
回复