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.

TMS320F28069: Problems about using INT13_ISR

Part Number: TMS320F28069

Hello. I'm currently using TMS320F28069 as the controller of my project and in the project, I need to use two interrupt for TIMER0 and TIMER1. When I read about the interrupt structure from the datasheet, I found that the interrupt signal of TIMER1 is directly sent into INT13 without entering PIE as shown below.

Presently, I have to modify the DefaultISR.c to set the interrupt function for Timer1 but I think it is not an elegant way. Other interrupts, who are controlled by the PIE block, can be set by changing the PIE configuration. So, I am wondering is there any way to assign the custom interrupt function for INT13 without changing DefaultISR.c.

  • Hi Yu,

    I modified the example project for LED blink to be for Timer 1 so you can see how to map the ISR without changing the DefaultISR.c file. 

    //
    // Included Files
    //
    #include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
    
    //
    // Function Prototypes statements for functions found within this file.
    //
    __interrupt void cpu_timer1_isr(void);
    
    //
    // Main
    //
    void main(void)
    {
        //
        // Step 1. Initialize System Control:
        // PLL, WatchDog, enable Peripheral Clocks
        // This example function is found in the F2806x_SysCtrl.c file.
        //
        InitSysCtrl();
    
        //
        // Step 2. Initalize GPIO:
        // This example function is found in the F2806x_Gpio.c file and
        // illustrates how to set the GPIO to it's default state.
        //
        // InitGpio();  // Skipped for this example
    
        //
        // Step 3. Clear all interrupts and initialize PIE vector table:
        // Disable CPU interrupts
        //
        DINT;
    
        //
        // Initialize the PIE control registers to their default state.
        // The default state is all PIE interrupts disabled and flags
        // are cleared.
        // This function is found in the F2806x_PieCtrl.c file.
        //
        InitPieCtrl();
    
        //
        // Disable CPU interrupts and clear all CPU interrupt flags
        //
        IER = 0x0000;
        IFR = 0x0000;
    
        //
        // Initialize the PIE vector table with pointers to the shell Interrupt
        // Service Routines (ISR).
        // This will populate the entire table, even if the interrupt
        // is not used in this example.  This is useful for debug purposes.
        // The shell ISR routines are found in F2806x_DefaultIsr.c.
        // This function is found in F2806x_PieVect.c.
        //
        InitPieVectTable();
    
        //
        // Interrupts that are used in this example are re-mapped to
        // ISR functions found within this file.
        //
        EALLOW;    // This is needed to write to EALLOW protected registers
        PieVectTable.TINT1 = &cpu_timer1_isr;
    
        EDIS;      // This is needed to disable write to EALLOW protected registers
    
        //
        // Step 4. Initialize the Device Peripheral. This function can be
        //         found in F2806x_CpuTimers.c
        //
        InitCpuTimers();   // For this example, only initialize the Cpu Timers
        
        //
        // Configure CPU-Timer 1 to interrupt every 500 milliseconds:
        // 80MHz CPU Freq, 50 millisecond Period (in uSeconds)
        //
        ConfigCpuTimer(&CpuTimer1, 80, 500000);
    
        //
        // To ensure precise timing, use write-only instructions to write to the
        // entire register. Therefore, if any of the configuration bits are changed
        // in ConfigCpuTimer and InitCpuTimers (in F2806x_CpuTimers.h), the
        // below settings must also be updated.
        //
        
        //
        // Use write-only instruction to set TSS bit = 0
        //
        CpuTimer1Regs.TCR.all = 0x4001;
    
        //
        // Step 5. User specific code, enable interrupts:
        //
    
        //
        // Enable CPU-Timer 1
        //
        IER |= M_INT13;
    
        //
        // Enable global Interrupts and higher priority real-time debug events
        //
        EINT;   // Enable Global interrupt INTM
        ERTM;   // Enable Global realtime interrupt DBGM
    
        //
        // Step 6. IDLE loop. Just sit and loop forever (optional)
        //
        for(;;);
    }
    
    //
    // cpu_timer1_isr -
    //
    __interrupt void
    cpu_timer1_isr(void)
    {
        CpuTimer1.InterruptCount++;  // See the Interrupt Count change in the expressions window
        
    }
    
    //
    // End of File
    //

    Best Regards,

    Marlyn