GPIO interrupt rising/falling edge

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO interrupt rising/falling edge

Jump to solution
2,127 Views
fasihahmed
Contributor IV

How to set GPIO (input) interrupt to be triggered based on rising/falling edge or steady state signal?
Im using GCT, code warrior 10.6, DSC MC56F82748

Labels (1)
1 Solution
1,975 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Fasih,

As you know that all the GPIO pins of MC56F827xx can be used to trigger interrupt, for the detailed inf, pls refer to the section:

34.2.6 GPIO Interrupt Enable Register (GPIOx_IENR)

pastedImage_25.png

34.2.7 GPIO Interrupt Polarity Register (GPIOx_IPOLR)

The register GPIOx_IPOLR can set up falling/rising edge to trigger interrupt of GPIO pins.

This is the interrupt vector table for MC56F827xx:

pastedImage_26.png

There is only one interrupt vector table for 16 GPIO pins, so in the ISR, you have to check which GPIO pin leads to the interrupt by checking the GPIO Interrupt Pending Register.

I will try to develop an example code based on GCT tools.

BR

XiangJun Rong

View solution in original post

2 Replies
1,976 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Fasih,

As you know that all the GPIO pins of MC56F827xx can be used to trigger interrupt, for the detailed inf, pls refer to the section:

34.2.6 GPIO Interrupt Enable Register (GPIOx_IENR)

pastedImage_25.png

34.2.7 GPIO Interrupt Polarity Register (GPIOx_IPOLR)

The register GPIOx_IPOLR can set up falling/rising edge to trigger interrupt of GPIO pins.

This is the interrupt vector table for MC56F827xx:

pastedImage_26.png

There is only one interrupt vector table for 16 GPIO pins, so in the ISR, you have to check which GPIO pin leads to the interrupt by checking the GPIO Interrupt Pending Register.

I will try to develop an example code based on GCT tools.

BR

XiangJun Rong

View solution in original post

1,975 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

pastedImage_1.png

GPIOC4 pin interrupt fonfiguration:

pastedImage_2.png

unsigned int flag=0x01;
#pragma interrupt on
void GPIOC4_ISR(void)
{

    //clear the GPIOC4 pending register
    ioctlGPIO_CLEAR_EDGE_SENSITIVE_INT_FLAG(GPIO_C,0x10);  
    //toggle GPIOE0
    if(flag)
    {
    ioctlGPIO_SET_PIN(GPIO_E,0x01);  
    }
    else
    {
        ioctlGPIO_CLEAR_PIN(GPIO_E,0x01);  
    }
    flag^=0x01;
}
#pragma interrupt off