1、主频设置
InitPll(DSP28_PLLCR,DSP28_CLKINDIV);
#define DSP28_CLKINDIV 1
#define DSP28_PLLCR 6
其他没有修改
2、定时器0设置
ConfigCpuTimer(&CpuTimer0, 60, 1); //CpuTimer0配置分频60M,定时周期1uS
Timer->CPUFreqInMHz = Freq;
Timer->PeriodInUSec = Period;
temp = (long) (Freq * Period);
Timer->RegsAddr->PRD.all = temp;
Timer->RegsAddr->TPR.all = 0; // Set pre-scale counter to divide by 1 (SYSCLKOUT):
Timer->RegsAddr->TPRH.all = 0;
3、定时器中断 ,定时1秒
interrupt void cpu_timer0_isr(void) {
CpuTimer0.InterruptCount++;
if(CpuTimer0.InterruptCount >= 1000000)
{
CpuTimer0.InterruptCount = 0;
GpioDataRegs.GPATOGGLE.bit.GPIO22 = 1; //测试下来,正常翻转
}
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
外部有源晶振:10M
我用示波器测GPIO22,周期一直是4秒,反复配置,都是这样,请问是什么地方有问题
(GPIO22的高电平和低电平各2秒,周期是4秒) |