Hi members,
We are using AM3359 ICE Board for our EtherCat based application. Here in our application, we require a timer of 1 us resolution.
We tried all the ways to implement the timer (Timer Module in sys-bios, HWI for timer etc.)
But we are not getting proper resolution. We are using timer6 on ICE board which is clocked by 24 MHz onboard crystal clock.
We are getting interrupt at every 2us instead of 1us even though we have set the timer reload count as
0xFFFFFFE7 (0xFFFFFFFF - 1us*24000000).
Can you help us to resolve this problem on priority. Here is the code snippets used for timer6 in sys-bios environment.
Void hwiTimer6Fxn(UArg arg)
{
GPIOPinWrite(SOC_GPIO_1_REGS, 9, GPIO_PIN_HIGH);
timestamp_count++;
GPIOPinWrite(SOC_GPIO_1_REGS, 9, GPIO_PIN_LOW);
}
void configureTimeStampTimer6(void)
{
Timer_Params timer6Params;
Error_Block eb;
DMTimer6ModuleClkConfig();
// Enable clock for DMtimer#6
Error_init(&eb);
Timer_Params_init(&timer6Params);
timer6Params.period = 1;
timer6Params.periodType = ti_sysbios_interfaces_ITimer_PeriodType_MICROSECS;
timer6Params.extFreq.lo = 24000000;
timer6Params.extFreq.hi = 0;
timer6Params.startMode = ti_sysbios_interfaces_ITimer_StartMode_USER;
timer6 = Timer_create(4, hwiTimer6Fxn, &timer6Params, &eb);
if (timer6 == NULL) {
System_abort("Timer 6 create failed");
}
}
void startTimeStampTimer6(void)
{
if(!timerStarted)
{
Timer_start(timer6);
timestamp_count = 0;
timerStarted = true;
}
}