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.

Timer_Create interrupt handler

Other Parts Discussed in Thread: SYSBIOS

Hello,

I'm using the following code to set a periodic pulse on a pin which works fine, but seems that my timerFn handler is being called, is there a way to disable interrupts for this timer? If I provide NULL instead of timerFn for the Timer_create does it mean SYS/BIOS will instead call a dummy handler? Also I was hoping to use this timer as a 64bit timer, not 32bit, but there's no way to configure that through program? Using TimerSettings I don't think anything was changed.

extern "C" void timerFn();
static void timerFn(uint32_t arg)
{
Assert_isTrue(1, NULL);//shouldn't reach here

}

Timer_Params timerParams;
Timer_Params_init(&timerParams);

Error_Block eb;
Error_init(&eb);


// timerParams.extFreq.lo = 24000000;
// timerParams.extFreq.hi = 0;
timerParams.period = 750; //=24Mhz/32kHz
 timerParams.gpioDatDir.gpio_diro12 = 1;//set TOUT12 as timer output

timerParams.startMode = Timer_StartMode_USER; //so that the user calls SetPeriod to start the timer
timerParams.runMode = Timer_RunMode_CONTINUOUS; //periodic timer
timerParams.periodType = Timer_PeriodType_COUNTS;
timerParams.controlInit.tien = 0;
timerParams.controlInit.cp = 0; //pulse mode
timerParams.controlInit.invout = 1; //inverted tstat drives pin tout
timerParams.controlInit.pwid = 0; //TSTATx goes inactive after 1 clock cycle
timerParams.controlInit.invin = 0; //no input
timerParams.half = Timer_Half_LOWER;

Timer_timerSettings[TIMER0].mode = Timer_Mode_64BITGPTIMER;
Timer_timerSettings[TIMER0].master = true;
Timer_timerSettings[TIMER0].ownerCoreId = 0;

Timer_handle s_hTimer = Timer_create(TIMER0, timerFn, &timerParams, &eb);//timer 0 set to T64P0_OUT12

Thank you and best regards,

David.

  • Hi David,

    I'm not sure what you trying to do and perhaps and there may be an easier way to do this. To answer your questions:

    David Luca said:
    I'm using the following code to set a periodic pulse on a pin which works fine, but seems that my timerFn handler is being called, is there a way to disable interrupts for this timer? If I provide NULL instead of timerFn for the Timer_create does it mean SYS/BIOS will instead call a dummy handler? Also I was hoping to use this timer as a 64bit timer, not 32bit, but there's no way to configure that through program? Using TimerSettings I don't think anything was changed.

    If you don't specify Timer_FuncPtr tickFxn in Timer_create(), then no Hwi object will be created to call timerFn. No dummy function will be called.

    In your .cfg file, you should use the device specific timer64:

    var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');

    This will allow you to use the timer64 specific features, e.g the 64-bit resolution. See the ti/sysbios/timers/timer64/Timer API docs