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.

SYS/BIOS system tick timer accuracy

Other Parts Discussed in Thread: SYSBIOS, AM3352

Hi,

Please let me ask some basic questions on the system tick in SYS/BIOS.

We understood the Clock module, by default, uses the ti.sysbios.hal.Timer module to
create a timer to generate the system tick.

1>What is the accuracy of this system tick?
2>And which clock source will be selected by default?

We are using SYS/BIOS(v6.4) with default Clock settings as shown below
the tick period is 1ms, but the Timer ID is mentioned as "ANY",
I would like to know which timer and which clock source will be selected in this case.

In our sample application(on AM3352)  using Clock_getTicks() , we found that system tick
is not that accurate. For every 1 second time there is an extra delay of 7ms.

Best Regards
Prad

  • Hi Prad,

    Prad1 said:

    1>What is the accuracy of this system tick?

    I would recommend asking this question on the devices forum i.e. Sitara processors forum for AM335x.

    Prad1 said:

    2>And which clock source will be selected by default?

    We are using SYS/BIOS(v6.4) with default Clock settings as shown below
    the tick period is 1ms, but the Timer ID is mentioned as "ANY",
    I would like to know which timer and which clock source will be selected in this case.

    When the Clock.timerId is set to "ANY", SYS/BIOS can use any of the available (or unused) timers. For AM335x, the available DMTimers are 2-7 (Timer id 0-5). If you look at the timer mapping table (link in DM Timer module's cdoc), you can look at all available timers for a particular device along with their corresponding timer id, interrupt number and default frequency.

    Timer mapping table -> http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sysbios/6_40_02_27/exports/bios_6_40_02_27/docs/cdoc/ti/sysbios/timers/dmtimer/doc-files/TimerTables.html

    As far as the clock source for the DM Timer goes, SYS/BIOS does not program the CLKSEL_TIMERx_SEL register. It is most likely being programmed by the gel files you are using. I believe the gel files change the clock source to the 32KHz clock and therefore SYS/BIOS uses 32KHz as the default timer frequency for AM335x DM Timers.

    In case you plan to change the timer clock source, please also configure the timer frequency in the DM Timer module. Depending on the version of SYS/BIOS this can either be done using Timer.intFreq (deprecated now) or Timer.intFreqs (preferable).

    Timer.intFreq -> http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sysbios/6_40_02_27/exports/bios_6_40_02_27/docs/cdoc/index.html#ti/sysbios/timers/dmtimer/Timer.html#int.Freqs

    Best,

    Ashish

  • Hi Ashish,

    Thank you for the information.

    As you mentioned SYS/BIOS can use any of the available (or unused) timers.
    Could you please let me know the way to find out which timer is being used
    currently for the system tick.

    Regards
    Prad

  • Hi Prad,

    You can look at the Clock module's ROV view to determine the timer id that is being used by the SYS/BIOS clock. Please note that the app execution needs to at least reach main() and the app be halted before you can view ROV. Here's a sample screenshot showing the Clock ROV view:

    Best,

    Ashish

  • Hi Ashish,

    Thank you for the information.
    And I am sorry for the delay.

    It seems by default DMTimer2(Timer id 5) is used by the SYS/BIOS.

    Using TI's ICE EVM board and a simple UART sample code
    I tried to collect SysTick data(100 samples) and found that
    on a average for every "1 second" time there is an extra delay of 7ms.
    Note: also checked the clock source of the timer but,there was no problem in the clock source.

    Is this delay somewhat related to the SYS/BIOS?
    If possible I would like to know if there is any way to get a accurate SysTick time.

    Best Regards
    Prad.

  • Hi Prad,

    How exactly are you measuring the delay ? Are you using an oscilloscope ? To accurately measure the timer interval, I would recommend creating a timer and toggle some GPIO pin in the timer ISR. You can then use an oscilloscope to measure the time period. The SYS/BIOS interrupt processing code will add some latency but it will be in the order of micro secs and since you will be measuring the interval between 2 GPIO pin toggles, this latency should cancel out.

    The DMTimers will drift over time but I am not sure what is the drift rate on a AM3xx device. I would suggest posting on the Sitara forum as they may have a better idea about clock drift rates. 

    Best,

    Ashish

  • Hi Ashish,

    Thank you for the reply,

    We are using the Clock_getTicks() and comparing that data with the
    Computer's time (win32 time API).

    Meanwhile we tried to check the DMTimer's accuracy without SYS/BIOS and it was
    quite accurate (for every "1 second" there was an addition of only 0.5ms).

    We believe this additional delay or inaccuracy in the Systick(7ms) is something related to the
    SYS/BIOS and not the DMTimer hardware.

    Regards
    prad