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.

DSP clock freq

Other Parts Discussed in Thread: OMAP3530

Hi,

I am using BIOS  bios_5_32_04 of DVSDK 3_00_00_29 on OMAP3530.

I am looking into why I sometimes have a mismatch in timing measurements. I am using the BIOS function, GBL_getFrequency(), to get the DSP clock frequency, and the following DSPCPUcycles = (cycle_count1 - cycle_count2) * CLK_cpuCyclesPerHtime() / GBL_getFrequency() to get elapsed time. Does GBL_getFrequency() always return the corrent running clock frequency of DSP (meaning it does not read from a pre-defined table)? Or I should look into somewhere else to get clock freq of DSP?

 

Thanks a lot!

  • Weihua,

    GBL_getFrequency() returns the value configured in the GBL module property GBL.CLKOUT.  The default configuration for your OMAP3530 should already have this value set.

    If you suspect that it is incorrect, his value may be modified at configuration time via your *.tcf file:

    bios.GBL.CLKOUT = 1234;

    or during runtime, via the API:

    GBL_setFrequency(1234);

    Steve

     

  • Steve,

    Thanks for your quick reply. When you said, this value can be modified, does it mean that the DSP will actually run at this xyz KHz freq? FYI, I am doing some measurements on OMAP3530. I am doing "cat /proc/cpuinfo" to get ARM running at 550MHz, and GBL_getFrequency() returns 330000 (330MHz). I checked the manual of OMAP3530 and this combo of clock freqs is rare. I was wondering if there are other _sure_ways to get at which freq my DSP is running.

     

    Thanks.

  • Weihua Sheng,

    There is no direct relationship between the value returned by GBL_getFrequency() and the actual frequency that the DSP is running. As Steve explained above, GBL_getFrequency() only returns the value that you have assigned to the bios.GBL.CLKOUT parameter. This value is assigned in the *.cfg file and can be assigned an updated value by your application by calling the function GBL_setFrequency( new_value ).

    For example, if you will power the device on and initially set the DSP clock frequency to 200MHz, you would want to use

    bios.GBL.CLKOUT = 200000;

    Then if your application changes the clock frequency to 50MHz by changing the PLL, for example to use less power, then you would call

    GBL_setFrequency( 50000 );

    As you worded it in your original post, the GBL_getFrequency() does "read from a pre-defined table", although that value may be changed by the DSP program.

    To determine the DSP clock frequency there must be some clock source that is well-defined, such as a Real-Time Clock 32KHz clock source. You could count the number of DSP clock ticks between those RTC clocks to determine the actual DSP frequency.

    Usually, you only need to check the DSP clock frequency this way during the development and debug process instead of within the running program itself. Once you have the PLL configurations done correctly, then you can use the bios.GBL.CLKOUT parameter and the GBL_setFrequency( new_value ) function to update the BIOS clock parameter that will be returned by GBL_getFrequency().

    But during the development and debug process, it is always a good idea to make sure that you have the PLL configurations right and that the DSP is running at the clock speed that you intend for it to run. The easiest way that I know to do this is by using a simple routine in your main() function, after setting all PLL values, and run that routine from CCS while watching a wall clock that has a seconds hand. If you would like to determine the DSP clock frequency outside of the DSP program, please see this forum post. The comments in the code explain how to use this simple routine to measure true clock frequency.

    Regards,
    RandyP