Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hi experts.
I am developing DSP RTOS program on IDKAM5728.
I configured a timer interruption. Days ago, I found that it don't interrupt strictly per 2ms when I set it as a 2ms interruption.
So I wrote some code to test it (I have changed the period as 10 ms ).
#include <xdc/std.h> #include <xdc/runtime/Error.h> #include <xdc/runtime/System.h> #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Task.h> #include <ti/sysbios/timers/dmtimer/Timer.h> //#include <ti/sysbios/hal/Timer.h> #include "c6x.h" void timerIsr2ms(UArg arg); Void taskFxn(UArg a0, UArg a1); Timer_Handle timerHandle; /* * ======== main ======== */ Int main() { Task_Handle task; Error_Block eb; System_printf("enter main()\n"); Error_init(&eb); task = Task_create(taskFxn, NULL, &eb); if (task == NULL) { System_printf("Task_create() failed!\n"); BIOS_exit(0); } Timer_Params timerParams; Timer_Params_init(&timerParams); timerParams.period = 10000; timerParams.runMode = Timer_RunMode_CONTINUOUS; timerParams.periodType = Timer_PeriodType_MICROSECS; timerParams.arg = 0; timerParams.extFreq.lo = 1000000; timerParams.extFreq.hi = 0; timerParams.startMode = Timer_StartMode_USER; timerHandle = Timer_create(Timer_ANY, timerIsr2ms, &timerParams, &eb); if (timerHandle == NULL) { System_abort("Timer create failed"); } BIOS_start(); /* does not return */ return(0); } Void taskFxn(UArg a0, UArg a1) { Timer_start(timerHandle); int delay; while(1) { Task_sleep(10); System_flush(); }; } unsigned int start=1, finish=1,time=0; void timerIsr2ms(UArg arg) { finish = TSCL; time = (finish-start); start = TSCL; System_printf("timer time is %d\n",time); }
and there is my cfg file:
var Defaults = xdc.useModule('xdc.runtime.Defaults'); var Diags = xdc.useModule('xdc.runtime.Diags'); var Error = xdc.useModule('xdc.runtime.Error'); var Log = xdc.useModule('xdc.runtime.Log'); var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf'); var Main = xdc.useModule('xdc.runtime.Main'); var Memory = xdc.useModule('xdc.runtime.Memory') var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); var Text = xdc.useModule('xdc.runtime.Text'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); var Swi = xdc.useModule('ti.sysbios.knl.Swi'); var Task = xdc.useModule('ti.sysbios.knl.Task'); var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); var Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer'); //var Timer = xdc.useModule('ti.sysbios.hal.Timer'); //Timer.intFreq.lo = 20000000; //Timer.intFreq.hi = 0; /* * Minimize exit handler array in System. The System module includes * an array of functions that are registered with System_atexit() to be * called by System_exit(). */ System.maxAtexitHandlers = 4; /* * The BIOS module will create the default heap for the system. * Specify the size of this default heap. */ BIOS.heapSize = 0x1000; /* * Build a custom SYS/BIOS library from sources. */ BIOS.libType = BIOS.LibType_Custom; /* System stack size (used by ISRs and Swis) */ Program.stack = 0x2000; /* Circular buffer size for System_printf() */ SysMin.bufSize = 0x200; /* * Create and install logger for the whole system */ var loggerBufParams = new LoggerBuf.Params(); loggerBufParams.numEntries = 16; var logger0 = LoggerBuf.create(loggerBufParams); Defaults.common$.logger = logger0; Main.common$.diags_INFO = Diags.ALWAYS_ON; System.SupportProxy = SysMin;
there is some of its output:
some time is strange.
And I have tried to configure intfreq as 20M and not to configure extfreq.
It get the similar outcome or even a worse one.
any help will be appreciated.
Regards
Yx