Other Parts Discussed in Thread: CONTROLSUITE
I have tried everything I can thing of but this simple step of setting an 80 millisecond timer is absolutely stumping me. I got the ADC and IQmathLib stuff all working (except my timer never stopped, so my running DFT's were not finishing...
I started with the simple configure timer and start timer functions from the examples, but the timer never ran, so I started loading registers by hand. I have stripped the code down to nothing and I am still absolutely perplexed.
The project is a clean slate. The board is proprietary but fully functional. 20MHz clock in and 100 MHz system clock. I am using CCS5.3, c2000 compiler 6.1. I have tried hardware reboot, XDS510USB reboot, closing CCS, ...
Looking at the watch windows, I see that TIM.all and TIM.half.xxx are completely unrelated.
CpuTimer0Regs.TCR.bit.TIF 0
CpuTimer0Regs.TCR.bit.TSS 0
CpuTimer0Regs.TIM.half.LSW 4608
CpuTimer0Regs.TIM.half.MSW 122
CpuTimer0Regs.TIM.all 8000000
Code - pretty much all of it at that...
No matter how many times I run the 1000 increment loop none of the clock variables change in the watch window and TIF never sets.
#include "DSP280x_Device.h"
#define PLLCR_VALUE 0x000A // SYSCLKOUT = (OSCLK*10)/2
int main(void)
{
int i;
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 1) {.../*standard PLL stuff*/}
//InitCpuTimers();
// Initialize timer control register:
CpuTimer0Regs.TCR.bit.TSS = 1; // 1 = Stop timer, 0 = Start/Restart Timer
CpuTimer0Regs.PRD.all = 0xFFFFFFFF; // why?
CpuTimer0Regs.TCR.bit.TRB = 1; // 1 = reload timer
CpuTimer0Regs.TCR.bit.TIE = 0; // 0 = Disable/ 1 = Enable Timer Interrupt
CpuTimer0Regs.TCR.bit.SOFT = 1;
CpuTimer0Regs.TCR.bit.FREE = 1; // Timer Free Run
CpuTimer0Regs.TCR.bit.TIF = 0; // Clear Timer Interrupt Flag
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
CpuTimer0Regs.TPR.all = 0;
CpuTimer0Regs.TPRH.all = 0;
// Initialize timer period in ticks at 100 MHz
CpuTimer0Regs.PRD.all = (long) (100 * 80000);
//CpuTimer0Regs.TIM.all = CpuTimer0Regs.PRD.all;
// Reload all counter register with period value:
CpuTimer0Regs.TCR.bit.TSS = 0; // 1 = Stop timer, 0 = Start/Restart Timer
CpuTimer0Regs.TCR.bit.TRB = 1;
while (!CpuTimer0Regs.TCR.bit.TIF)
{
for (i=0;i<1000;i++);
i--; // just to keep a line for a breakpoint
}
return 0;
}
