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.

RTOS/AM4378: Inaccuracy of Timer Module

Part Number: AM4378
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi,

The customer configure timer to trigger a led every 200us. But the actual interruption frequency is 166us which is higher than the value expected. And the result was tested by oscilloscope. Are there any solutions to solve this phenomenon? Please help to analyze.

Below is the configuration.

timerParams.period = 200;

timerParams.periodType = Timer.PeriodType_MICROSECS;

timerParams.arg = 1;

Timer.create(null, '&Timer200us_Int', timerParams);

  • NAncy,

    What is the input clock to DMtimer on the board ? Is this on the EVM or IDK or custom board.  I would recommend customer to refer to pm_a9.cfg to see how timer can be configured.  I suspect that the timer input is set to 20 MHz but the board is using 24 MHz so  it is generating incorrect timing based on this input clock.

    The correct syntax of using timer and configuring input clock to timer 3 and 4 is as shown below

    /***********************************************

    *           Timer Module Configuraion         *

    ***********************************************/

    /* Set to 1-ms Tick and Enable Wakeup for OVF interrupt */

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

    var timerParams = new Timer.Params();

    timerParams.period = 1000 * 10;

    timerParams.twer.ovf_wup_ena = 1;

    timerParams.tiocpCfg.emufree = 1;

    timerParams.tsicr.posted = 0;

    /* Timer ID = 3 for GPTimer2 and input clock runs at 24 MHz */

    Timer.intFreqs[3].hi = 0;

    Timer.intFreqs[3].lo = 24000000;

    Timer.create(3, '&mainTimerTick', timerParams);

    /* Assign GPTimer4 to be used for Timestamp */

    /* Timer ID = 4 for GPTimer4 and input clock runs at 24 MHz */

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

    var timerParams2 = new DMTimer.Params();

    timerParams2.tsicr.posted = 0;

    DMTimer.intFreqs[4].hi = 0;

    DMTimer.intFreqs[4].lo = 24000000;

    var DMTimestampProvider = xdc.useModule("ti.sysbios.timers.dmtimer.TimestampProvider");

    DMTimestampProvider.timerId = 4;

    DMTimestampProvider.useClockTimer = false;

    var Timestamp = xdc.useModule("xdc.runtime.Timestamp");

    Timestamp.SupportProxy = DMTimestampProvider;

    /* Indicate GPT3 & GPT4 are used */

    var TimerSupport = xdc.useModule('ti.sysbios.family.arm.a9.am437x.TimerSupport');

    TimerSupport.availMask = 0x0018;

    Hope this helps

    Regards,

    Rahul

    PS: Refer to TI RTOS notes provided here:

    http://processors.wiki.ti.com/index.php/Processor_SDK_RTOS:_TI_RTOS_Tips_And_Tricks#How_to_get_accurate_clock_ticks_from_the_clock_module.3F