NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

SYS/BIOS dmtimer configuration for TI81xx

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

TI814x and TI816x SOCs both contain a timer module named 'dmtimer'. This module can be accessed and used by all CPUs on the SOC - the A8, C674, and both VIDEO-M3 and VPSS-M3 processors. SYS/BIOS contains a SW module that supports application configuration and use of this timer, but there are other system components that lie outside of the dmtimer HW that affect the operation of dmtimer, namely the clock that is used to drive the timer. This clock is outside the focus of the application writer since it is a "system setting" that is ultimately determined by the system integrator.

In practice, this issue applies only to the C674 CPU, since SYS/BIOS uses a different timer for the 2 M3 CPUs (a timer that is dedicated to just the M3 cores).

SYS/BIOS needs to be informed of the dmtimer clock input frequency setting so that it can program the dmtimer HW correctly to generate the desired time base. The SYS/BIOS ti.sysbios.timers.dmtimer.Timer Module contains configuration elements that are set to the value of the dmtimer's input clock frequency. It's important to realize that these configuration elements are only *informational* and don't actually result in programming the dmtimer's input clock. Since they're informational they need to have the correct information, and it is the application writer's responsibility to provide this information.

The result of not matching the SYS/BIOS dmtimer clock frequency with the actual clock frequency is an incorrect SYS/BIOS timebase. Specifically:

  • when SYS/BIOS's clock frequency is too low, too many timer tick interrupts, possibly flooding the CPU with timer tick processing at such a rate that no other processing can occur
  • when SYS/BIOS's clock frequency is too high, too few timer tick interrupts, resulting in highly delayed triggering of events based on the timer tick (timeouts).

On C6x+ processors (as the C674 is), in addition to interrupt-based timer operation, there is a special TimeStamp Counter (TSCH/TSCL registers) that counts at the rate of the CPU. This counter is completely separate from the dmtimer and is not affected by misconfiguration of the dmtimer. This timebase is used by SYS/BIOS for profiling or timestamp display in various places.

HLOS dmtimer input clock[edit]

In machines running a HLOS (High Level Operating System) such as Linux on TI814x or TI816x SOCs, it is the HLOS's responsibility to configure the device to decide between either a 32 KHz clock or a higher frequency clock (20/24/27 MHz, depending on the system HW) as the dmtimer input clock. When the SYS/BIOS application eventually runs, the dmtimer will be operating at the frequency selected by the HLOS, and as such the SYS/BIOS dmtimer module needs to be informed of this frequency. This frequency selection *might* be performed by the bootloader of the HLOS, or by the HLOS itself, or possibly even some boot code that runs and boots the HLOS bootloader itself. When the HLOS selects the frequency, it might do so as part of "default initialization" or by some explicit request by some element of the HLOS software suite (typically a device driver).

All of the above is mentioned in order to highlight the fact that the dmtimer input clock is controlled by a variety of sources and therefore SYS/BIOS cannot assume one or the other to be the norm. This means that even though SYS/BIOS will provide a default setting for the input frequency, it is advised that the application explicitly set the input frequency.

Setting the dmtimer input frequency[edit]

The following configuration code snippet is from a SYS/BIOS configuration script (.cfg file). It informs SYS/BIOS that the dmtimer input clock is running at 20,000,000 Hz. <syntaxhighlight lang="c"> /* set the Timer frequency to 20MHz */ var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer'); Timer.intFreq.hi = 0; Timer.intFreq.lo = 20000000; </syntaxhighlight>

As of the date of this writing, for TI814x & TI816x SYS/BIOS v6.32.05.54 contains a default configuration of: <syntaxhighlight lang="c"> /* set the Timer frequency to 32KHz */ var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer'); Timer.intFreq.hi = 0; Timer.intFreq.lo = 32768; </syntaxhighlight>

Also as of the date of this writing, SysLink contains samples that explicitly set the input clock frequency to 32 KHz, and Codec Engine contains examples that don't set it at all (thereby relying on the default SYS/BIOS setting). For CodecEngine projects the above explained setting can be done within the ti_platforms_<platform name>.cfg files of the codec server.

TI81XX EVMs[edit]

A major complicating factor for all of this is the fact that u-boot and Linux are constantly changing, and both can contain (or not contain) code for configuring the clock input choice. On top of that, this clock input choice can change from version to version, or PSP to PSP, depending on the whim of the developer or system integrator (or, quite possibly, the current level of Cosmic Microwave Background radiation :)

This makes it very difficult for SYS/BIOS to pick a reasonable default setting for the input clock frequency. Some systems will boot up to a dmtimer clock input of 32 KHz, while others will boot up with 20 MHz, and others still might boot up with 27 MHz. Some systems will have multiple settings performed, with possible u-boot, Linux default, and explicit Linux device driver settings applied consecutively, with the last one "winning".

Questions[edit]

  • How can I find out the setting of my system's dmtimer input clock frequency?
    • On Linux, if debugfs is enabled in the kernel configuration, you can display the value with:
      • TODO <fill in Linux /sys/debugfs command>
    • On SYS/BIOS, you can open ROV, select the Clock module, and observe the rate of increase of the 'ticks' element.
      • TODO <fill in ROV display here>
    • Direct inspection of the register that controls the dmtimer's clock input selection:
      • TODO <fill in register name/picture here>
  • How can I change the system's dmtimer input clock frequency?
    • TODO Kernel source code - change the value of ABC in the kernel file foo.c
    • TODO Direct register write - write either X or Y to register REG
  • What are the symptoms of a misconfigured SYS/BIOS dmtimer frequency?
    • When SYS/BIOS's clock frequency is too low, too many timer tick interrupts, possibly flooding the CPU with timer tick processing at such a rate that no other processing can occur. The application can appear stuck, and if you were to use a debugger to stop the remote core's execution you would likely see the CPU performing some SYS/BIOS timer-related processing.
    • When SYS/BIOS's clock frequency is too high, too few timer tick interrupts, resulting in highly delayed triggering of events based on the timer tick (timeouts). If your application does not have any timeout-based operation, nor were you observing some timer-based display, you likely wouldn't even notice the problem.

Conclusion[edit]

The SYS/BIOS application writer should explicitly set the dmtimer's input clock frequency, which will force the application writer to discover to what frequency their system is set.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article SYS/BIOS dmtimer configuration for TI81xx here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article SYS/BIOS dmtimer configuration for TI81xx here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article SYS/BIOS dmtimer configuration for TI81xx here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity