Not getting interrupt using GPIO PIN Interrupt in lpc1837 ?

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

Not getting interrupt using GPIO PIN Interrupt in lpc1837 ?

453 Views
ponalagappan
Contributor III

I am using LPC1837, i need to enable active low interrupt in individual GPIO PIN.

 

 

 

/* enable GPIO port clock */

GPIO_PortClock(1);

 

/* Set GPIO6[0]  pin and GPIO6[2] as input */
GPIO_SetDir(6,0,GPIO_DIR_INPUT);
GPIO_SetDir(6,2,GPIO_DIR_INPUT);

 

/* enable pin as GPIO Mode pin in pin multiplexing*/
SCU_PinConfigure(0xC,1,( SCU_CFG_MODE_FUNC4 | SCU_SFS_EPUN | SCU_SFS_ZIF ));

SCU_PinConfigure(0xC,3,( SCU_CFG_MODE_FUNC4 | SCU_SFS_EPUN | SCU_SFS_ZIF ));

 

/* set values for PINTSEL0 to choose GPIO Port 6,pin no 0 on INTPIN0 */
SCU_PinInterruptSourceSelect(0x00, 0x06, 0x00);

/* set values for PINTSEL0 to choose GPIO Port 6,pin no 2 on INTPIN1 */
SCU_PinInterruptSourceSelect(0x01, 0x06, 0x02);

/* enable level interrupt */

LPC_GPIO_PIN_INT->ISEL = (GPIO_PIN_INT_ISEL_PMODE0_Msk |
GPIO_PIN_INT_ISEL_PMODE1_Msk);

/* enable level interrupt */

LPC_GPIO_PIN_INT->IENR = (GPIO_PIN_INT_IENR_ENRL0_Msk |
GPIO_PIN_INT_IENR_ENRL1_Msk );


LPC_GPIO_PIN_INT->SIENR = ( GPIO_PIN_INT_SIENR_SETENRL0_Msk |
GPIO_PIN_INT_SIENR_SETENRL1_Msk );

/* IST setting immediately after setting SIENR bit, but my hardware pin state is HIGH only  */

/* enable active LOW interrupt */

LPC_GPIO_PIN_INT->IENF = 0x00UL;

LPC_GPIO_PIN_INT->CIENF = (GPIO_PIN_INT_CIENF_CENAF0_Msk |
GPIO_PIN_INT_CIENF_CENAF1_Msk );


NVIC->ICPR[(((uint32_t)(int32_t)33) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)33) & 0x1FUL));

NVIC->ISER[(((uint32_t)(int32_t)33) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)33) & 0x1FUL));

Is that require to write IST->PSTATx to clear inside interrupt??

void GPIO1_IRQHandler(void)
{

/* write IST bits as 1 to clear the interrupt*/
LPC_GPIO_PIN_INT->IST = (GPIO_PIN_INT_IST_PSTAT0_Msk |
                                                 GPIO_PIN_INT_IST_PSTAT1_Msk);

}

To enable interrupt is that require any other preliminary settings required? Am i missing something??????

Tags (2)
0 Kudos
1 Reply

290 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

I've already given the reply in the GPIO PIN interrupt is not working in LPC 1837 .

Please have a check.

Ping
Have a great day,
(my name)

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

0 Kudos