如题,我的代码中初始化了一个定时器0,但是在用debug下载程序和直接点刷写按钮的方式下,发现GPIO的反转速度是不一样的,代码如下:
interrupt void cpu_timer0_isr(void);
void init_timer(){
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TIMER0_INT = &cpu_timer0_isr;
//PieVectTable.TIMER1_INT = &cpu_timer1_isr;
//PieVectTable.TIMER2_INT = &cpu_timer2_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitCpuTimers();
// 200MHz CPU Freq, 1 second Period (in uSeconds)
ConfigCpuTimer(&CpuTimer0, 200, 500000);
// To ensure precise timing, use write-only instructions to write to the entire register. Therefore, if any
// of the configuration bits are changed in ConfigCpuTimer and InitCpuTimers (in F2837xS_cputimervars.h), the
// below settings must also be updated.
CpuTimer0Regs.TCR.all = 0x4000; // Use write-only instruction to set TSS bit = 0
IER |= M_INT1;
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
}
int a=0;
interrupt void cpu_timer0_isr(void)
{
CpuTimer0.InterruptCount++;
// Acknowledge this interrupt to receive more interrupts from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
GpioDataRegs.GPDTOGGLE.bit.GPIO108 = 1;
a++;
}
,貌似点了绿色虫子的下载模式定时器时间才是对的,在测试中下载完成后我都断点重启过,结果一样。