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.

gpio interrupt error in LCDKC6748

Hello,

I am using C6748 LCDK.

I want to use pin GP5[0] as a interrupt on falling  edge for that I write code

userswitch3();
     CONFIG_enable_user_switch3_interrupt();

void userswitch3(void)
{
    GPIODirModeSet(SOC_GPIO_0_REGS, 81, GPIO_DIR_INPUT);

}

void CONFIG_enable_user_switch3_interrupt(void)
{
    /*
    ** Configure rising edge and falling edge triggers on pin 81 to generate
    ** an interrupt
    */
    GPIOIntTypeSet(SOC_GPIO_0_REGS, 81, GPIO_INT_TYPE_FALLEDGE);

    /* Enable interrupts for Bank 5.*/
    GPIOBankIntEnable(SOC_GPIO_0_REGS, 5);

    /* Configuring the AINTC to handle interrupts.*/
    SetupInt();

    /* Configure GPIO interrupts */
    CONFIG_IntGPIO_user_switch3();
}

/*
** \brief  This function configures the AINTC to receive the GPIO interrupt.
*/

static void CONFIG_IntGPIO_user_switch3(void)
{
    // Configure GPIO interrupts for ARM or DSP

#ifdef _TMS320C6X
    // Register the ISR in the Interrupt Vector Table
    IntRegister(C674X_MASK_INT5, GPIO_user_switch3_Isr);

    // Map the system interrupt to the DSP maskable interrupt
    IntEventMap(C674X_MASK_INT5, SYS_INT_GPIO_B5INT);

    // Enable DSP maskable interrupt
    IntEnable(C674X_MASK_INT5);
#else
    // Register the ISR in the Interrupt Vector Table.
    IntRegister(SYS_INT_GPIOB5, GPIO_user_switch3_Isr);

    // Map the channnel number 2 of AINTC to GPIO BANK 5 system interrupt.
    IntChannelSet(SYS_INT_GPIOB5, 2);

    // Enable the System Interrupts for AINTC.
    IntSystemEnable(SYS_INT_GPIOB5);
#endif
}

void GPIO_user_switch3_Isr(void)
{




    /* Disable the interrupts for pins of bank 5 in GPIO.*/
    GPIOBankIntDisable(SOC_GPIO_0_REGS, 5);



#ifdef _TMS320C6X
    // Clear the system interrupt status in the DSPINTC
    IntEventClear(SYS_INT_GPIO_B5INT);
#else
    /* Clears the system interrupt status of GPIO in AINTC.*/
    IntSystemStatusClear(SYS_INT_GPIOB5);
#endif

    /* Clears the Interrupt Status of GP5[0] in GPIO.*/
    GPIOPinIntClear(SOC_GPIO_0_REGS, 81);



    //flag = 1;
   
   



    /* Enable interrupts for pins of bank 5.*/
    //GPIOBankIntEnable(SOC_GPIO_0_REGS, 5);

 
}

static void SetupInt(void)
{
    // Setup ARM or DSP interrupt controller

#ifdef _TMS320C6X
    // Initialize the DSP Interrupt Controller
    IntDSPINTCInit();

    // Enable DSP Interrupts Globally
    IntGlobalEnable();
#else
    /* Initialize the ARM Interrupt Controller.*/
    IntAINTCInit();

     /* Enable IRQ in CPSR.*/
    IntMasterIRQEnable();

    /* Enable the interrupts in GER of AINTC.*/
    IntGlobalEnable();

    /* Enable the interrupts in HIER of AINTC.*/
    IntIRQEnable();
#endif
}

But problem is that interrupt comes two times instead of one . Even after the execution of isr, no interrupt pending in INSTAT45 register and interrupt disable in BINTEN register.

Please give the some solution of that problem.

regards

Sachin Arora

  • Hi Sachin,

                 I think the example code you have posted is written based upon the gpio_carddetect.c of the evmC6748 examples but you are using C6748_LCDK.

    Kindly take a look at the gpio_carddetect example of the C6748_LCDK of the starterware.

                Let us know by which method you are ensuring that the code comes with two interrupts? Are you validating the number of interrupts with some printf statements?

    Regards,

    Iyshwarya

  • Hello Iyshwarya,

    For C6748_LCDK, only led blinking example available (in gpioCardDetect.c). Is their any difference evmC6748 and C6748_LCDK in respect of enabling gpio interrupt.

    Also I confirm two interrupts by debugging the code. I give only single pulse (high to low signal ) confirm from CRO.

    regards

    Sachin Arora

  • Hello,

    I want to enable enable internal pull down for gpio pin .For that  I select pull down  in PUPD_SEL register and enable pull down  by using PUPD_ENA.

    For example I want to enable pull down for GP8.14 for that I write 0xFFFFBFFF in PUPD_SEL register and 0xFFFFFFFF in PUPD_ENA register. But when I check the signal at this pin, it still high (3.3V).

    I want to know how I make internal  pull down enable.

    regards

    Sachin Arora

  • Hi Sachin,

                The GPIO5[0] pin which you are using as input is floating pin which may cause false switching or double time.Kindly check by soldering one pull-up resistor(4.7K) from the external connector J14.21 to VCC_3V3D and check whether you are getting two interrupts only.

                For your other question on  PUPDENA and PUPSEL please check with the Technical reference manual(SPRS586D) for how to use the Pull-Up and Pull-Down  PUPDENA and PUPDSEL registers.

     

    Regards

    Iyshwarya

    If this answers your question, please click the Verify Answer button below. If not, please reply back with more information.

  • Hello Iyshwarya,

    I add the pull up resistor(4.7K) at pin J14.21 (GPIO5[0]), but still the interrupt appears two times.

    regards

    Sachin Arora