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.

TMS320F28335: External Interrupt function is not working when trigger is given

Part Number: TMS320F28335


Tool/software:

Hi,

I've written a basic code to toggle a GPIO (in this case GPIO47) and read the interrupt call count every time GPIO42 changes (which acts as the trigger). However, when there is a trigger, neither GPIO47 changes nor the counter variable increases. I have checked it with the TI example available, used the same code, but the error persists.
Controller: TMS320F28335
CCS version: 12.8


Please help fix the issue.

#include "DSP28x_Project.h"

// ISR Prototype
__interrupt void xint1_isr(void);

volatile Uint32 Xint1Count = 0;

void main(void)
{
    // Step 1: Initialize System Control
    InitSysCtrl();

    // Step 2: Initialize GPIO
    InitGpio();

    // Configure GPIO42 as input (trigger source)
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 0;  // GPIO function
    GpioCtrlRegs.GPBDIR.bit.GPIO42 = 0;   // Input
    GpioCtrlRegs.GPBQSEL1.bit.GPIO42 = 0; // Sync to SYSCLK

    // Configure GPIO47 as output (toggle pin)
    GpioCtrlRegs.GPBMUX1.bit.GPIO47 = 0;  // GPIO function
    GpioCtrlRegs.GPBDIR.bit.GPIO47 = 1;   // Output
    EDIS;

    // Step 3: Configure External Interrupt XINT1
    EALLOW;
    GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 42; // Map GPIO42 -> XINT1
    EDIS;

    XIntruptRegs.XINT1CR.bit.POLARITY = 3;  // 1 = Rising edge, 0 = Falling edge, 3 = Both edges
    XIntruptRegs.XINT1CR.bit.ENABLE   = 1;  // Enable XINT1

    // Step 4: Enable PIE & CPU Interrupts
    InitPieCtrl();
    IER = 0x0000;
    IFR = 0x0000;

    InitPieVectTable();

    EALLOW;
    PieVectTable.XINT1 = &xint1_isr;   // Hook ISR
    EDIS;

    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;        // Enable PIE
    PieCtrlRegs.PIEIER1.bit.INTx4 = 1;        // Enable XINT1 in PIE group 1
    IER |= M_INT1;                            // Enable group 1 interrupts
    EINT;                                     // Enable Global INTM
    ERTM;                                     // Enable DBGM

    // Step 5: Idle loop
    for(;;)
    {
        asm(" NOP");
    }
}

// Interrupt Service Routine for GPIO42 -> toggle GPIO47
__interrupt void xint1_isr(void)
{
    // Toggle GPIO47
    GpioDataRegs.GPBTOGGLE.bit.GPIO47 = 1;
    Xint1Count++;
    // Acknowledge interrupt to receive more
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}


Thanks & Regards, 
Priyadarshini N M