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.

F28M35x the name of interrupt PORTD

Other Parts Discussed in Thread: CONTROLSUITE

Hello friends,

The name of GPIOx interrupt service is GPIO_Port_D_ISR() or GPIODIntHandler()???I have not found some information about that.Because when I have finished configuring GPIO20 as a interrupt input and triggered by FALLING_EDGE,but it does not work as I changed the level of input. And now I am a little confused.Thank you!

Best Regards,

  • Hi Hongyue,

    You might be missing something; can you paste your implementation?

    Regards,

    Gautam

  • Hi Gautam,

    It seem to have gone into an infinite loop when I change the level of GPIO20.The following is my code:

    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_nvic.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_types.h"
    #include "inc/hw_sysctl.h"
    #include "driverlib/debug.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"


    //中断函数声明
    void GPIODIntHandler(void)
    {
     volatile unsigned long ulLoop,ulIntStatus,toggle1=0;
          ulIntStatus = GPIOPinIntStatus(GPIO_PORTD_BASE,true);
           GPIOPinIntClear(GPIO_PORTD_BASE,ulIntStatus);
        if(toggle1==0)
        {
         GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, 0);
         toggle1=1;
        }
        else
        {
         GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, ~0);
         toggle1=0;
        }

    }


    //*****************************************************************************
    // The error routine that is called if the driver library encounters an error.
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, unsigned long ulLine)
    {
    }

    #endif

    int
    main(void)
    {

        volatile unsigned long ulLoop;

        // Disable Protection
        HWREG(SYSCTL_MWRALLOW) =  0xA5A5A5A5;

        // Sets up PLL, M3 running at 100MHz and C28 running at 100MHz
        SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xA) |
                             SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_1 |
                             SYSCTL_XCLKDIV_4);

        // Enable clock supply for GPIOC
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
        //使用GPIOD——GPIO20作为中断输入
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

        GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_4);
        GPIOIntTypeSet(GPIO_PORTD_BASE, GPIO_PIN_4, GPIO_FALLING_EDGE);
        IntPrioritySet(INT_GPIOD,0x00);
        IntEnable(INT_GPIOD);
        GPIOPinIntEnable(GPIO_PORTD_BASE, GPIO_PIN_4);
        GPIOPortIntRegister(INT_GPIOD,GPIODIntHandler);

        // Disable clock supply for the watchdog modules
        SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG1);
        SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG0);
       
        // Enable processor interrupts.
        IntMasterEnable();

        GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_7);
        GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_6);
        GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, ~0);
        GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, ~0);
       
        // Loop forever while the timers run.
        while(1)
        {
            //
            // Turn on the LED.
            //
            GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, 0);
            //
            // Delay for a bit.
            //
            for(ulLoop = 0; ulLoop < 2000000; ulLoop++)
            {
            }
            //
            // Turn off the LED.
            //
            GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, ~0);
            //
            // Delay for a bit.
            //
            for(ulLoop = 0; ulLoop < 2000000; ulLoop++)
            {
            }

        }
    }

    Best Regards,

    Hongyue

  • Hi Hongyue!

    Try thus:

    interrupt void GPIODIntHandler(void)

    {..............

    }

    Also check your code through following references: ti\controlSUITE\device_support\f28m35x\v160\MWare\driverlib\   gpio.c & interrupt.c.

    Regards,

    Igor

  • Hi lgor,

    Thank you! I have tried "interrupt void GPIODIntHandler(void)",the situation is the same as before.When I change the level of GPIO20,program will go into an infinite loop.And it will stop here,as shown in figure:

     

  • Hello!

    Perhaps I don't understand you right. Does your code work right when you use the interrupt from GPIO_PIN_4 of other port (A,B or C)? Did you try this? Is LED blinking at this case? Is GPIO_PIN_7 (of port D) switching? 

    Regards,

    Igor

  • Hello lgor,

    It also doesn't work when I use the interrupt from GPIO_PIN_4 of other PORTJ.And the LED2 will stop blinking when interrupt occurs,LED3 does not blink yet.When I press F8,the program will execute in INTDefaultTHandler of startup_ccs.c.

    Best Regards,

    Hongyue

  • Hello!

    1 BTW about  volatile unsigned long ulLoop,ulIntStatus,toggle1=0; - this declaration should be outside of your ISR "void GPIODIntHandler(void)" and better outside of main().

    2 Did you try example ti\controlSUITE\device_support\f28m35x\v201\F28M35x_examples_Master\blinky\m3\ on your board?

    Regards,

    Igor

     

  • Hello lgor,

    I have tried what you said in the above post,but it still doesn't work.Is there any method to verify which function has invoked the "IntDefaultHandler" in CCS,when a interrupt occurs?What has this situation been leaded?  Thank you!

    Best Regards,

    Hongyue

  • Hello!

    Sorry, I didn't understand something. Did you try example  ti\controlSUITE\device_support\f28m35x\v201\F28M35x_examples_Master\blinky\m3\. It must work.

    Regards,

    Igor

  • Hello lgor,

    Thank you! I have solved the problem,and I replace the INT_GPIOD with GPIO_PORTD_BASE in the GPIOPortIntRegister().Now the interrupt works well.

    Best Regards,

    Hongyue

  • Hello!

    Congratulations! This is an elementary problem of incorrect parameter of function "GPIOPortIntRegister(unsigned long ulPort, void (*pfnIntHandler)(void))". Param ulPort is the base address of the GPIO port (gpio.c). But I did not notice...

    Good luck,

    Igor