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.

CCS/PROCESSOR-SDK-OMAPL137: Unable to configure timer as counter using SYS/BIOS for OMAPL137

Part Number: PROCESSOR-SDK-OMAPL137
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hi,

I am trying to configure timer as counter using SYS/BIOS .cfg file. I have added following to my .cfg file

var ti_sysbios_timers_timer64_Timer0Params = new ti_sysbios_timers_timer64_Timer.Params();
ti_sysbios_timers_timer64_Timer0Params.instance.name = "ti_sysbios_timers_timer64_Timer0";
ti_sysbios_timers_timer64_Timer0Params.emuMgtInit.soft = false;
ti_sysbios_timers_timer64_Timer0Params.periodType = xdc.module("ti.sysbios.interfaces.ITimer").PeriodType_COUNTS;
ti_sysbios_timers_timer64_Timer0Params.extFreq.lo = 0;
ti_sysbios_timers_timer64_Timer0Params.period = 2000;
ti_sysbios_timers_timer64_Timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
ti_sysbios_timers_timer64_Timer0Params.half = ti_sysbios_timers_timer64_Timer.Half_LOWER;
Program.global.ti_sysbios_timers_timer64_Timer0 = ti_sysbios_timers_timer64_Timer.create(1, null, ti_sysbios_timers_timer64_Timer0Params);

If we use Timer_getCount API to get the counter value of timer but the counter value next time not starting from zero instead of that it decreases from my period value.

How can I configure timer as counter and also how to calculate frequency from counter value?

  • Hi Gangadhar,

    You can use the "ti.sysbios.timers.timer64.TimestampProvider" module if you would like to use the Timer64 as a counter. The TimestampProvider module uses timer64 for timestamping. It provides an API to get either 32-bit or 64-bit timestamps and also has an API that returns the timer frequency.

    Here's what needs to be added to the configuration to use this timestamp module:

    *.cfg:
    
    var TimestampProvider = xdc.useModule("ti.sysbios.timers.timer64.TimestampProvider");
    TimestampProvider.useClockTimer = false; // Use timer64 instead of clock for timestamping

    Note: If reading 64-bit timestamps, please ensure the timestamp is read at least once before the timestamp counter overflows. Otherwise, the upper 32-bits are not updated.

    Here's a link to the cdoc for this module. It lists all the supported APIs:

    software-dl.ti.com/.../TimestampProvider.html

    Best,

    Ashish

  • Thanks for the reply Ashish.

    TimestampProvider_get32() or TimestampProvider_get64() functions will return either 32-bit or 64-bit timestamp value. To convert the timestamp value into frequency we need to use TimestampProvider_getFreq(). I am not understanding here how we can calculate the timestamp into frequency. What is the formula to convert timestamp into frequency?

  • Hi Gangadhar,

    I don't understand your frequency measurement need. Can you elaborate a little ?

    TimestampProvider_get32()/get64() and TimestampProvider_getFreq() can be used to convert timestamp counts into time units (count/freq).

    Best,

    Ashish

  • Hi Ashish,

    How to use TimestampProvider_getFreq() to convert timestamp counts into time units, means value got from TimestampProvider_get32()/get64() API is timestamp value only not the freq right.
  • Gangadhar,

    Consider the following code

    Types_FreqHz freq;

    Timestamp_getFreq(&freq);

    We don't have any devices that would have a non-zero freq.hi. Let's say the the freq.lo is 48000000 (48MHz). That means the Timestamp_get32 and get64 counts increase by 48MHz every second.

    Todd