对28069芯片选用外部无缘晶振8M,对系统分频配置时,
#define DSP28_DIVSEL 3 // Enable /1 for SYSCLKOUT
#define DSP28_PLLCR 10
void InitSysCtrl()
{
XtalOscSel();
InitPll(DSP28_PLLCR, DSP28_DIVSEL);
InitPeripheralClocks();
InitCpuTimers();
}
void InitCpuTimers(void)
{
// CPU Timer 0
// Initialize address pointers to respective timer registers:
CpuTimer0.RegsAddr = &CpuTimer0Regs;
//Clear interrupt flag
CpuTimer0Regs.TCR.bit.TIF = 0;
//Disable CPU_timer interrupt
CpuTimer0Regs.TCR.bit.TIE = 0;
CpuTimer0Regs.TCR.bit.FREE = 0;
//Stop after the next decrement of the TIMH:TIM (hard stop)
CpuTimer0Regs.TCR.bit.SOFT = 0;
// Initialize timer period to maximum:
CpuTimer0Regs.PRD.all = 0xFFFFFFFF;
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT):
CpuTimer0Regs.TPR.all = 79; // (80MHz/1MHz-1)
CpuTimer0Regs.TPRH.all = 0;
// Make sure timer is stopped:
CpuTimer0Regs.TCR.bit.TSS = 0;
// Reload all counter register with period value:
CpuTimer0Regs.TCR.bit.TRB = 0;
// Reset interrupt counters:
CpuTimer0.InterruptCount = 0;
}
按照道理,主频应该为80MHZ,CPUtimer0是1M,但实测后,发现主频是50Mhz