This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

6678定时器例程改写疑问

还是C:\Program Files\Texas Instruments\pdk_C6678_1_0_0_16\packages\ti\csl\example\timer这个例程,我想利用GP-TIMER得到想要的定时中断,于是,我改写了test_gp_time()这个函数,修改如下:

TimeCountMode 改为 CSL_TMR_ENAMODE_CONT;

hwSetup.tmrTimerPeriodLo = 0x3B9ACA00;            // 即十进制的1000000000

hwSetup.tmrTimerPeriodLo = 0x00;

为了能够不停产生中断,我把while(timeISRCounter !=1);去掉,

然后为了能查看每次产生的中断,我修改OStickISR(void)

{timeISRCounter++ ;

printf("The timeISRCounter is %d.\n" , timeISRCounter);

 }             加了这句printf语句

默认的是内部时钟,是6分频,则应该是每6秒产生一次中断,但是我在运行的时候,发现瞬间就输出了将近100条printf语句,也就是说没有达到设置的中断周期间隔。应该如何设置呢?

  • 您好,

    首先确认一下你是在simulator还是EVM板子上测试的?建议在EVM板子上测试,这样时间更准!

    另外建议在每次进入中断时使用读取TSC寄存器记录当前时刻,同时注意如果要测试cycle最好不要在程序中使用printf,因为printf很费时间。