Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Hi,
I am trying to use Timer o and Timer 2 interrupt for internal use in my code. Timer 0 interrupt is working fine but when I configured timer 2 interrupt the ISR is not executing.
This works fine with 'Timed LED blinking' code in C2000 Ware, but when I am using those timers in my code with ADC and other peripherals interrupt is not coming.
Below is the line of code used for interrupt configuration.Please let me know if anything is missing.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &cpu_timer0_isr;
PieVectTable.TINT2 = &cpu_timer2_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
ConfigCpuTimer(&CpuTimer2, 150, 10000);
CpuTimer2Regs.TCR.all = 0x4000;
IER |= M_INT1;
//
// Enable TINT0 in the PIE: Group 1 interrupt 7
//
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
IER |= M_INT14;
/////////////////////////////////////////////////////////////////////////////////////
//Timer 0 configured somewhere in code
if(sine_mains.I2T_TimeUpdate_flag==1)
{
CpuTimer0Regs.TCR.bit.TSS=1;
ConfigCpuTimer(&CpuTimer0, 150, sine_mains.Timer_Count);
// ConfigCpuTimer(&CpuTimer0, 150, 500000);
CpuTimer0Regs.TCR.all = 0x4000;
sine_mains.I2T_TimeUpdate_flag=0;
}
//////////////////////////////////
/////ISR///////////////
cpu_timer0_isr(void)
{
//
// Toggle GPIO32 once per 500 milliseconds
//
if(CpuTimer0.InterruptCount==0)
{
//GpioDataRegs.GPBCLEAR.bit.GPIO32=1;
// CpuTimer0Regs.TCR.all = 0x0000;
CpuTimer0Regs.TCR.bit.TSS=1;
//
// Acknowledge this interrupt to receive more interrupts from group 1
//
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
CpuTimer0.InterruptCount++;
}
__interrupt void
cpu_timer2_isr(void)
{
GpioDataRegs.GPBCLEAR.bit.GPIO32=1;
CpuTimer2Regs.TCR.bit.TSS=1;
//
// Acknowledge this interrupt to receive more interrupts from group 1
//
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}