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.

Launchpad Port C6 don't trigger interrupt

Other Parts Discussed in Thread: EK-TM4C123GXL

Hi

I am programming a prototype connected to my launchpad EK-TM4C123GXL board. 

Prototype has five switch buttons. Three of them are connected to pins A2, A3 aNd A4, another one connected to D6 and last button is connected to C6 pin.

Port A and port D pins work fine, and when i push some button they trigger interrupt function. But pin C6 doesn't   trigger the interrupt routine on a pin change.

I think that configuration pins are correct, but i don't know where the problem is with PC6 pin or port C.

My configuration code:

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

GPIOPortIntRegister (GPIO_PORTA_BASE, PortAIntHandler);
GPIOPortIntRegister (GPIO_PORTC_BASE, PortCIntHandler);
GPIOPortIntRegister (GPIO_PORTD_BASE, PortDIntHandler);

GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6);
GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_6);

GPIOPadConfigSet ( GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );//
GPIOPadConfigSet ( GPIO_PORTC_BASE , GPIO_PIN_6 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );
GPIOPadConfigSet ( GPIO_PORTD_BASE , GPIO_PIN_6 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );

GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4, GPIO_FALLING_EDGE);//
GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE);
GPIOIntTypeSet(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE);

GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
GPIOPinIntEnable(GPIO_PORTC_BASE, GPIO_PIN_6);
GPIOPinIntEnable(GPIO_PORTD_BASE, GPIO_PIN_6);

GPIOPinIntClear ( GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 );
GPIOPinIntClear ( GPIO_PORTC_BASE , GPIO_PIN_6 );
GPIOPinIntClear ( GPIO_PORTD_BASE , GPIO_PIN_6 );

IntEnable (INT_GPIOA);
IntEnable (INT_GPIOC);
IntEnable (INT_GPIOD);

IntMasterEnable();
any idea or change???
regards
Jose Manuel
  • Hello Jose,

    I tested the code on the TM4C123 launchPad and PC6 does generate an interrupt on Falling Edge.

    I had to make some code changes as below (since it seemed you were using an older release of TivaWare)

        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

        GPIOIntRegister(GPIO_PORTA_BASE, PortAIntHandler);
        GPIOIntRegister(GPIO_PORTC_BASE, PortCIntHandler);
        GPIOIntRegister(GPIO_PORTD_BASE, PortDIntHandler);

        GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
        GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6);
        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_6);

        GPIOPadConfigSet ( GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );//
        GPIOPadConfigSet ( GPIO_PORTC_BASE , GPIO_PIN_6 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );
        GPIOPadConfigSet ( GPIO_PORTD_BASE , GPIO_PIN_6 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );

        GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4, GPIO_FALLING_EDGE);//
        GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE);
        GPIOIntTypeSet(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE);

        GPIOIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
        GPIOIntEnable(GPIO_PORTC_BASE, GPIO_PIN_6);
        GPIOIntEnable(GPIO_PORTD_BASE, GPIO_PIN_6);

        GPIOIntClear(GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 );
        GPIOIntClear(GPIO_PORTC_BASE , GPIO_PIN_6 );
        GPIOIntClear(GPIO_PORTD_BASE , GPIO_PIN_6 );

        IntEnable (INT_GPIOA);
        IntEnable (INT_GPIOC);
        IntEnable (INT_GPIOD);

        IntMasterEnable();

    Regards

    Amit

  • Highlighting of any/all changes would have better revealed them....

    edit: we note now - post above has (properly) highlighted (3 areas) the corrected code blocks...  Makes recognition/understanding so much easier...

  • Hi Amit,

    I have just updated Tivaware to last release, but i have same problem with interrupt PC6. I have tested another Port C pins, and doesn't   trigger the interrupt. Can it be a problem with my launchpad module?  or problem with port C? I have changed a switch of Port A, that it works fine, and connected it to pin PC6 or another Port C pins and anything doesn't trigger interrupt.

    regards,

    Jose

  • Hello Jose,

    It would be hard to believe that Port C Pins are gone (JTAG is still working). If you have another LaunchPad it may be worthwhile testing it on a second one.

    BTW, PC0-3 will not work without unlocking the pin, but using them as GPIO would cause you to lose the JTAG.

    Regards

    Amit

  • Amit,

    i can not see the problem. I have programing a simple sample. I have configured a interrupt in PA3 to change value pin of serveral pins.  I have configured pin PA5, port C pins (4 to 7), port D pins (0 to 3, 6 and 7) and port F (0 to 4) as a OUTPUT with pinmux tool.

    Only pin PA5 change value. Other pins don't change value.

    I send you attached zip project (launchpad). There is any problem with configuration project? or ports C, D and F configuration? libraries versions? 

    Tiva release software: TivaWare_C_Series-2.1.0.12573

    8540.launchpad.zip 

  • Hello Jose

    I ran the code you had and the Port C Pins changed the value from 0 to 1, when PA3 is connected to GND (falling edge)

    Before PA3 falling edge

    After PA3 Falling Edge

    Regards

    Amit

  • Hi Amit,

    last chance for my code...

    I have just test my code with another new launchpad... Doesn't work interrupt PC6 pin port :-(

    I send you attached the project... Is possible any problem with configuration project? includes, libraries, etc...?

    Is there another way to test interrupt ?

    1803.interrupts.zip

    regards

    Jose Manuel

  • Hello Jose,

    I can try using your CCS project to see if there is a generic issue or not. I will update as soon as I have some results

    Regards

    Amit

  • Hi Amit,

    Have you been able to test the project I sent you? Can I send you more information about my CCS configuration?

    I am waiting for your reply to choose the development platform.

    Regards,

    Jose Manuel

  • Hello Jose

    Sorry for the delay. What I saw in the code is a logical problem. But before I get to that I just want to confirm the connection. What I have done is connected the PA5 to PC6 through a wire. Is that what you have on your side?

    Problem: The PA5 is configured as output. The default register content for the GPIODATA is 0x0. Hence it drives as 0.

        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5);

    So when the read is done it will read as 0 and invert the same to 1. This will not generate a falling edge.

    I modified the code as

        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5);

        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_PIN_5);

    and after that it started going to the interrupt handler for PC6

    /*
     * main.c
     */
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/tm4c123gh6pm.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    
    
    
    void PortAIntHandler(void)
    {
    	GPIOIntClear(GPIO_PORTA_BASE , GPIO_PIN_3 );
    
    	int readPin = GPIOPinRead(GPIO_PORTA_BASE,GPIO_PIN_5);
    
    	GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, ~readPin);
    
    }
    
    void PortCIntHandler(void)
    {
    	GPIOIntClear(GPIO_PORTC_BASE , GPIO_PIN_6 );
    
    	int readPin = GPIOPinRead(GPIO_PORTA_BASE,GPIO_PIN_5);
    
    	GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, ~readPin);
    
    }
    
    void PortDIntHandler(void)
    {
    	GPIOIntClear(GPIO_PORTD_BASE , GPIO_PIN_6 );
    
    	int readPin = GPIOPinRead(GPIO_PORTA_BASE,GPIO_PIN_5);
    
    	GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, ~readPin);
    }
    
    
    
    void main(void){
    
    	SysCtlClockSet (SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN);
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    
        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5);
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_PIN_5);
    
        GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_3);
        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_6);
    	GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6);
    
    	GPIOPadConfigSet( GPIO_PORTA_BASE , GPIO_PIN_3 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );
    	GPIOPadConfigSet( GPIO_PORTC_BASE , GPIO_PIN_6 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );
    	GPIOPadConfigSet( GPIO_PORTD_BASE , GPIO_PIN_6 , GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU );
    
    	GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_FALLING_EDGE);
    	GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE);
    	GPIOIntTypeSet(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE);
    
    	GPIOIntEnable(GPIO_PORTA_BASE, GPIO_PIN_3);
    	GPIOIntEnable(GPIO_PORTC_BASE, GPIO_PIN_6);
    	GPIOIntEnable(GPIO_PORTD_BASE, GPIO_PIN_6);
    
    	IntMasterEnable();
    
    	IntEnable(INT_GPIOA);
    	IntEnable(INT_GPIOC);
    	IntEnable(INT_GPIOD);
    
    	int readPin = GPIOPinRead(GPIO_PORTA_BASE,GPIO_PIN_5);
    	GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, ~readPin);
    
    	while(1)
    	{
    
    	}
    }
    

    Regards

    Amit