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.

TimestampProvider_getFreq

Other Parts Discussed in Thread: TMS320C6457, SYSBIOS

How does TimestampProvider_getFreq determine the frequency it returns?

  • Brian,

    It depends upon the device.  The frequency may be based upon on a counter running at the CPU frequency, or on the frequency of a timer peripheral used for timestamping.  On some devices both options are available, based upon the application configuration.

    Which device are you asking about?  Are you using a default timestamp configuration, or changing it?

    Scott

  • I am asking about the TMS320C6457 device.  I am using the default timestamp configuration (as far as I know, I did not change anything).

  • Brian,

    For the C6457 the CPU’s timestamp counter (TSC) is used for timestamping.  In this case, TimestampProvider_getFreq() simply returns the CPU clock rate.

    The source for this and the related TimestampProvider functions can be found in the SYS/BIOS install, for example: C:\ti\bios_6_33_06_50\packages\ti\sysbios\family\c64p\TimestampProvider.c

    /*
     *  ======== TimestampProvider_getFreq ========
     */
    Void TimestampProvider_getFreq(Types_FreqHz *freq)
    {
        BIOS_getCpuFreq(freq);
    }

    Also, there is a summary page in each SYS/BIOS install that lists the “delegates” used to implement family-specific functions.  For example: C:\ti\bios_6_33_06_50\packages\ti\sysbios\family\doc-files\delegates.html.  You can look up the device in that table to know which delegates are used.

    Scott

  • Gary,

    Thank you very much for your response.  The reason I am asking the question, is that I have two boards that I am running on.  One of the boards I call the IP board (our custom C6457 based hardware).  The other board is a TMDSEVM6457 EVM board.  I am running bios 6.32.05.54.  I am expecting the call to TimestampProvider_getFreq to return the frequency of the 64 bit high speed timer, so I can timestamp things in our software.  The problem is that when I run the same software on both boards, the call to TimestampProvider_getFreq returns 166666666 on both boards.  When I do a "wall clock" test, it appears that the two boards do not have the same frequency for the 64 bit high speed timer.  It appears that the frequency of 166666666 (166.6 Mhz) is correct for the IP board.  It appears that the same frequency is incorrect on the TMDSEVM6457 board (it seems like the frequency of the 64 bit high speed timer on the TMDSEVM6457 board is closer to 200 Mhz).

    When I add code to make the call BIOS_getCpuFre(freq) on the EVM board the value I get back is 1000000000 (1.0 Ghz).  This is inconsistent with the call to TimestampProvider_getFreq(freq) which returns 166666666 (166Mhz) on the same EVM board.  This implies that the code in TimestampProvider.c is not what is really being run.

    What are your thoughts?

  • Brian,

    Can you post the application configuration files (with .cfg extensions)?  Maybe the CPU frequency is being declared there?

    Thanks,
    Scott

  • Scott,

    The only place that the CPU frequency is specified, that I know of, is in the platform.  I am using the same platform for both boards, and in this platform the CPU frequency is set to 1000 Mhz.  It could be that the EVM is set to run at 1200 Mhz, not 1000 Mhz, and so the platform I am using for both boards is not correct for the EVM.  I will try to determine what frequency the EVM CPU is running at.

    Thank you for your help.  I feel that I am now on the right path to find the answer I am looking for.  I will let you know what I find.

    Brian

  • Scott,

    Here is what I found:

    The CPU frequency is indeed stored in the platform.  When the function TimestampProvider_getFreq is called, it returns (CPU frequency / 6), which is what is expected.  So the EVM hardware is running at 1200 Mhz and our IP board is running at 1000 Mhz (I had our IP board designer help me verify this).  For correct operation, I need to set the CPU frequency in the EVM platform to 1200 Mhz.

    Thank you again for your help, as it helped guide me to the answers to my original questions,

    Brian

  • Brian,

    OK, thanks for reporting back.  I’m puzzled where the divide by 6 is coming from, but will follow up on that offline…

    Scott

  • Scott,

    I don't know what the code is like inside the clock freq get function, but the TMS320C6457 Data Manual SPRS582B July 2010,  page 15, Table 2-1, shows:

    64-Bit Timers (configurable) (internal clock source = CPU/6 clock frequency).

    Brian

  • OK, thanks Brian.  Those 64-bit configurable timers are different than the C64x+ CPU’s timestamp counter (TSC) that is used by default for reporting timestamps. 

    The TSC is a free running, CPU-local counter that runs at the CPU’s clock rate.  The high (TSCH) and low (TSCL) 32-bit portions can be read separately; TSCL is read for a 32-bit timestamp and both TSCH and TSCL are read for a 64-bit timestamp.

    The 64-bit timer peripherals *can* be used for timestamping too, but that is not the default configuration.  The application would need to explicitly select ti.sysbios.timers.timer64 as the TimestampProvider.  If that is the case, then the divide by 6 makes sense.  Do you see something like this in your application configuration file?

    Timestamp = xdc.useModule('ti.sysbios.timers.timer64.TimestampProvider');

    Thanks,
    Scott

  • Yes, I am using xdc.useModule('ti.sysbios.timers.timer64.TimestampProvider').  After BIOS_start has been called the 64-bit timer is correctly setup for use as a 64-bit timestamp clock.

    Brian

  • Brian,

    Whenever I get a new EVM or a new customer board and want to make sure everything is setup right, one of the first things is to make sure what speed the DSP is running at. So I do a wall clock test using the TSC. I posted the code and instructions on the TI Wiki Pages at What is my DSP clock speed? You may be past the point of needing it, but in case it can help you or someone else, here it is.

    Regards,
    RandyP

  • Brian,

    One more thing to add… I wonder why you are using the 64-bit timer’s TimestampProvider versus using the default provider that uses the TSC?  The TSC implementation is about as simple as can be, and provides higher resolution.  The only advantage I can think of for using the discrete timer peripheral is that it should continue to run even if the CPU’s clock is gated off for power management.  Other than that, I don’t see any advantage, and FWIW, would recommend using the TSC provider.

    Scott