This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

i could not reset the gpiote pin interrupt

i am using nrf51822 s110 sdk7.2.0

1.i had initialized and configure the gpiote interrupt before mainloop for (pin no 10). 2.i had wrote the process on interrupt handler. 3.got the external interrupt successfully. 4. clear the event in interrupt handler. 5. start to do some function like uart operation in that same pin(pin no.10) 6.if i got interrupt i will send 'U'. 7.after finished uart operation i had cleared interrupt and re enabled interrupt to do next time get external interrupt.

my problem is , i could stop the interrupt triggering its always triggering the interrupt. that mean always sending 'U'. From the main loop. once i will transfer 'U' then i need to stop the interrupt.

please any one help me.

mainloop function:-

				Ext_interrupt_enable(CLOSE);
				hw_UartEnableTx(CLOSE);
				hw_UartEnableRxNOINT(CLOSE);
				Ext_interrupt_enable(OPEN);               //FOR INT FROM LOCK & ENCODER
			
				if(tUserKey->tUserTsk.Top_tsk==0x00)
				{
				sleep();
				}			
 
gpiote functions:-
void GPIOTE_IRQHandler()
{
	if ((NRF_GPIOTE->EVENTS_IN[0] == 1) &&
        (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN0_Msk))
    {
       NRF_GPIOTE->EVENTS_IN[0] = 0;
			tUserKey.tUserTsk.Top_tsk=Top_Buttontsk;
			tUserKey.tUserTsk.Buttontsk=bt_scan;
   }
		if ((NRF_GPIOTE->EVENTS_IN[1] == 1) &&
        (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN1_Msk))
    {			
      NRF_GPIOTE->EVENTS_IN[1] = 0;
      //tUserKey.Ext_int_En_flg=1;  //			
			tUserKey.tUserTsk.Top_tsk=Top_Buttontsk;
			tUserKey.tUserTsk.Buttontsk=bt_scan;
    }
		if ((NRF_GPIOTE->EVENTS_IN[2] == 1) &&
        (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN2_Msk))
    {
			//Ext_interrupt_enable(CLOSE);
			NRF_GPIOTE->EVENTS_IN[2] = 0;
			tUserKey.Ext_int_En_flg=1;
			tUserKey.tUserTsk.Top_tsk = Top_Systsk;
			tUserKey.tUserTsk.Systsk |= Sys_LockCharge;
				nrf_delay_ms(5);
    }
}

void gpiote_init(void)
{
    NRF_GPIOTE->CONFIG[0] = (GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos)
                            | (0 << GPIOTE_CONFIG_PSEL_Pos)
                            | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);	
	 NRF_GPIOTE->CONFIG[1] = (GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos)
                            | (1 << GPIOTE_CONFIG_PSEL_Pos)
                            | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);
	NRF_GPIOTE->CONFIG[2] = (GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos)
                            | (10 << GPIOTE_CONFIG_PSEL_Pos)
                            | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);	
NVIC_EnableIRQ(GPIOTE_IRQn);
	tUserKey.Ext_int_En_flg=0;
}
Related