hi,
i m getting one strange observation while configure the CPU timers in the TMS320F28020 controller. i did below configuration for timers.but after configuration i m able to start only CPUTimer0 not CPUtimer1.
after a diagnosis i found that. Am i getting value "40000" TIM0PeriodValue variable and in TIM1PeriodValue i getting value "0". i tried with different period value also but i always getting "0 " value in the "CpuTimer1Regs.PRD.all" register
long TIM1PeriodValue, TIM1PeriodValue =0;
InitCpuTimers();
ConfigCpuTimer(&CpuTimer0, 40, 1000);
ConfigCpuTimer(&CpuTimer1, 40, 1000);
TIM1PeriodValue = CpuTimer1Regs.PRD.all;
TIM0PeriodValue = CpuTimer0Regs.PRD.all;
CpuTimer0Regs.TCR.all = 0x4001; //start timer
CpuTimer1Regs.TCR.all = 0x4001; //start timer
Can any one help me , why i can't modify the " CpuTimer1Regs.PRD.all". or im missing somthing in configuration.
void InitCpuTimers()
{
EALLOW;
// CPU Timer 0
// Initialize address pointers to respective timer registers:
CpuTimer0.RegsAddr = &CpuTimer0Regs;
// Initialize timer period to maximum:
CpuTimer0Regs.PRD.all = 0xFFFFFFFF;
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT):
CpuTimer0Regs.TPR.all = 0;
CpuTimer0Regs.TPRH.all = 0;
// Make sure timer is stopped:
CpuTimer0Regs.TCR.bit.TSS = 1;
// Reload all counter register with period value:
CpuTimer0Regs.TCR.bit.TRB = 1;
// Reset interrupt counters:
CpuTimer0.InterruptCount = 0;
CpuTimer1.RegsAddr = &CpuTimer1Regs;
// CpuTimer2.RegsAddr = &CpuTimer2Regs;
// Initialize timer period to maximum:
CpuTimer1Regs.PRD.all = 0xFFFFFFFF;
// CpuTimer2Regs.PRD.all = 0xFFFFFFFF;
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT):
CpuTimer1Regs.TPR.all = 0;
CpuTimer1Regs.TPRH.all = 0;
// CpuTimer2Regs.TPR.all = 0;
// CpuTimer2Regs.TPRH.all = 0;
// Make sure timers are stopped:
CpuTimer1Regs.TCR.bit.TSS = 1;
// CpuTimer2Regs.TCR.bit.TSS = 1;
// Reload all counter register with period value:
CpuTimer1Regs.TCR.bit.TRB = 1;
// CpuTimer2Regs.TCR.bit.TRB = 1;
// Reset interrupt counters:
CpuTimer1.InterruptCount = 0;
// CpuTimer2.InterruptCount = 0;
}