This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C129EXL: How can I set up and configure new GPIO as interrupts in S2E examples?

Part Number: EK-TM4C129EXL
Other Parts Discussed in Thread: EK-TM4C1294XL

Hi, 

How can I set up and configure new GPIO as interrupts?

I am new to EK-TM4C129EXL board but trying to use it for serial to Ethernet application.

Based on ENET_S2E, i would like to add set up new GPIO PK4,PK5 and PK6 as interrupt for additional functionality.

In which "ene_s2e" directory/files should I amend the modifications and configurations? is there any simple code I can refer to?

Kind regards,

Jean

  • Hi,

      There is a GPIO interrupt example at C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\interrupts. You can reference this example. In this example, GC0, GL1 and GB3 pins are used to generate interrupts. You can adapt to PK4, PK5 and PK6. The code is quite simple, you can add the interrupt code in the main() if you want. 

  • Thank you Charles, the examples did give an insight of setting the GPIO. However, the reference set interrupts as outputs. I forgot to mention that I want to set GPIO as input for external signals. PK4 and PK5 as external PU and PK6 as external PD.

    is there any reference on GPIO as external PD interrupts?

    Kind regards,

    Jean

  • Hi,

      Below is an example code for PP0 and PP1 to generate interrupts based on falling edge inputs.

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOP))
    {
    }
    GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
    GPIOIntTypeSet(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_FALLING_EDGE);


    GPIOIntRegisterPin(GPIO_PORTP_BASE, GPIO_PIN_0, UserButton1ISR);
    GPIOIntRegisterPin(GPIO_PORTP_BASE, GPIO_PIN_1, UserButton2ISR);

    GPIOIntEnable(GPIO_PORTP_BASE, GPIO_INT_PIN_0 | GPIO_INT_PIN_1);

    IntEnable(INT_GPIOP0);
    IntEnable(INT_GPIOP1);
    IntMasterEnable();

  • Hi Charles,

    Thank you so much.

    That solved my problems.

    Kind regards,

    Jean