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.

CCS/TMS320F2812: Why PDPINTA interrupt happen without stimulation؟

Part Number: TMS320F2812


Tool/software: Code Composer Studio

Hi,

Am trying XINT1 using TMS320F2812 in a test card.

InitXIntrupt sometimes works sometimes doesn't,

Even though PDPINTA  interrupt (INT1.1) is not active, it still happens 

my code:

#include "DSP28_Device.h"

//unsigned  int  *LedADDR  = (unsigned int *)0x4600;    //LED control register
interrupt void ExtIntISR(void);
Uint16    Temp;

void main(void)
{

    InitSysCtrl();                    //initialize the system

    DINT;                            //disable interrupts
    IER = 0x0000;
    IFR = 0x0000;

    InitPieCtrl();                   //Initialize PIE


    // Disable CPU interrupts and clear all CPU interrupt flags:
       IER = 0x0000;
       IFR = 0x0000;

    InitPieVectTable();                //Initialize PIE interrupt vector table
  //  InitPeripherals();                //initialize peripherals
     InitGpio();                        //initialize GPIO
    InitXIntrupt();                    //Initialize external interrupt
    
    EALLOW;    
    
    PieVectTable.XINT1 = &ExtIntISR;
    
    EDIS;   
    
     XIntruptRegs.XINT1CR.bit.ENABLE = 1;            // Enable XINT1 pin
     XIntruptRegs.XINT1CR.bit.POLARITY = 1;          // Interrupt triggers on rising edge

    //*LedADDR=0xFF;
     // Enable the PIE block
     PieCtrl.PIECRTL.bit.ENPIE = 1;

     // Enable PIE group 1 interrupt 1-8

    //open the interrupt
    PieCtrl.PIEIER1.all = 0x0008;     //external interrupt 1 PIE group 1 where the first four
    // Make sure PIEACK for group 1 is clear (default after reset)
    PieCtrl.PIEACK.all = M_INT1;

    // Enable CPU INT1
    IER |= M_INT1;
    EINT;                           // Enable INTM
    ERTM;                            // Enable DBGM


    GpioDataRegs.GPADAT.all = 0x0000;
    Temp=0xFF;
    for(;;);
}     

interrupt void ExtIntISR(void)
{

    PieCtrl.PIEACK.all = 0xFFFF;
    PieCtrl.PIEIFR1.bit.INTx4 = 0;//0000 1101 0100 0111
    ERTM;
    EINT;
    Temp^=0xFF;
    GpioDataRegs.GPADAT.all = Temp;
}

  • Nima,

    Try to follow the example code a little closer, this would make it easier for you to follow and debug.  For example, notice that you disabled all CPU interrupts and cleared all CPU interrupt flags twice (IER and IFR in the beginning of your code).  Next, in your ISR you should only acknowledge the bit for the group.  For example:

    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;   // Acknowledge interrupt to PIE -- PIEACK_GROUP1 is defined as 0x0001

    Do not modify the PIEIFR (in your ISR).  See chapter 6 in the "TMS320x281x DSP System Control and Interrupts Reference Guide":

    http://www.ti.com/lit/spru078

    Make these modifications and test again.  I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken

  • Hi Ken

    Thanks for your quick reply
    After checking all the registries
    The bug was fixed

    با تشکر از پاسخ سریع شما
    بعد از چک کردن همه رجیسترها
    ایراد برطرف شد