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 issue on TI814x

Other Parts Discussed in Thread: SYSBIOS

Hi

On my TI814x board, I've noticed that OS-tick runs 3.7% slower than expected, i.e a task_sleep(1000) takes 1037 ms to complete. After some debugging, I saw that SYS/BIOS configures the GPTIMER3 and sets the TLDR register to 0xffffffde and that the timer compare register is set to zero, i.e. the timer should reload on each 34 timer input clk. I'm assuming that the timer is driven by a 32768Hz ref clk (SYSCLK18 in the Data Manual) , so 34000/32768 is approx the 3.7% difference I'm detecting.

So, I guess that SYS/BIOS should set the TLDR to 0xffffffdf (gives 33 instead of 34 ticks), to have the clock tick as precise as possible with 32768 Hz refclk?

Or, is it possible to configure the timer so that we get an even more accurate tick?

BR

Niklas

  • Niklas,

    Yes, you are correct regarding the value that needs to be programmed into TLDR.  I've filed a bug against BIOS to keep track of this (SDOCM00081403).

    In the mean time, I can think of two possible workarounds:

    1) Configure the timers to operate at 20Mhz (instead of 32.768 KHz) and configure BIOS to expect the timers to operate at this frequency.  Any minor difference in the value written to TLDR will be negligible if you do this. 

    Configuring the timers to actually operate at 20MHz instead 32.768 KHz involves changing the clock sources that drive the GPTimers.  How do you currently initialize your timers? Via a GEL script or using a routine called on the A8?

    Once you've changed the timers' operating frequency, BIOS can be configured to work with this frequency as follows:

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

    Timer.intFreq.lo = 20000000; //20Mhz

    Timer.intFreq.hi = 0;

    After making this change BIOS will calculate/write a new value of TLDR that will accommodate the new timer frequency for a given tick period.

    2) Keep your timers operating at 32.768 KHz but 'trick' BIOS into writing a value of TLDR that will more closely yield a 1ms tick period.  I.e. for a period of 1000 us (1 ms):

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

    Timer.intFreq.lo = 31768;

    Timer.intFreq.hi = 0;

    Regards,

    Shreyas

  • Hi again, Shreyas

    Thanks for your fast reply.

    two more questions about the timer.

    1. In the Data Manual for the chip, it says that the chip has 8 GP timers, not DM (dual mode timer). I can not find any reference that it is dual mode timer. Still, your work-around above suggests that it really are dual mode timers on the chip, not GP as the data manual says. Could you please clarify this.

    2. My .cfg file looks like this

    var ti_sysbios_knl_Clock = xdc.useModule('ti.sysbios.knl.Clock');
    ti_sysbios_knl_Clock.tickPeriod = 1000;
    ti_sysbios_knl_Clock.tickSource = ti_sysbios_knl_Clock.TickSource_TIMER;

    So, I don't specify any clock source for the timer or the speed of that clocksource. Also, I've failed to understand how I change the clocksource of the Timers, i.e I've found no information about this in the TRM, DM or the PRCM doc for the chip. Can you direct me where to find the information I need.

    BR

    Niklas

  • Niklas,

    The device manuals/specs still continue to use the older term 'GP Timers' (which, I believe, are generally present in older devices), but the timers on TI81xx are actually DM timers.

    I'm working to obtain a GEL script that programs the clocksource to operate the timers at 20Mhz.  I'll get back to you regarding this.

    Regards,

    Shreyas

  • Hello,

     

    I am working on the TI816x evm and I am also searching for any user guide for the on chip timers.

    As Niklas said, the few data that is provided about the timers seems not to be so relevant to the chip.

    Also the Sys/Bios guide not really explain how to deal with the timers.

    Could you provide any updated documentation about that subject.

     

    Thanks,

    Jonathan.