Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

What is my DSP clock speed

From Texas Instruments Wiki
Jump to: navigation, search

It is very common to wonder if the DSP is really running at the clock speed you set it for. This application note offers one simple method for measuring the approximate clock speed of a DSP that is based on the C64x+ core, including the C674x and C66x DSPs and including the DSPs that are embedded in DaVinci and C6-Integra devices.

Download the DSPClockSpeed test program

Click the link to download the Project zip file to a temporary location on your computer.

Randyp_DSPClockSpeed.zip (Date: Nov 21, 2011)

Import the DSPClockSpeed project

The DSPClockSpeed project can be imported from the Randyp_DSP_ClockSpeed.zip file into CCSv4 or CCSv5. The zip file contains an archived CCSv4 project that will easily work in CCSv5, also. For CCS 3.x, you may use the main.c and lnkdsp.cmd files, but you will have to create your own project file.

Import to CCSv4

Use the CCSv4 File->Import command to import the DSPClockSpeed project into your workspace using these steps:

  1. From the CCSv4 main menu, select the File->Import command
  2. Select as source type CCS:Existing CCS/CCE Eclipse Projects
  3. Select an archive file
  4. Browse to the Randyp_DSPClockSpeed.zip file or enter the path to it
  5. Select the DSPClockSpeed project
  6. Click Finish

Since this program was built and archived from a workspace using CCSv4.2.4.00033 and Code Generation Tools 7.2.3, there may be some "housekeeping" needed to make your build and debug experience run smoothly. Please follow these steps to make sure the right tools are selected:

  1. In the C/C++ Projects window, right-click on the project folder name and select Build Properties..., select CCS Build in the left pane then the General tab
  2. Click the drop-down arrow for Device Variant: and select the device type that you are using; this project was built for the C674x, so you may need to change it to Generic C64x+
  3. Click the drop-down arrow for Code Generation tools and select the latest version of CGT that you have. Earlier versions like 6.0.x may work but have not been tested (please comment here if you test them). If your latest version is not yet in the list, click More then Select tool from file-system and browse to the folder, such as C:\TI\Tools\C6000 Code Generation Tools 7.3.1, then click OK and OK.
  4. Click OK to save these changes and select Apply changes to existing build configuration in the Save Build Configuration Settings window if it comes up.

Import to CCSv5

Use the CCSv5 File->Import command to import the DSPClockSpeed project into your workspace using these steps:

  1. From the CCSv5 main menu, select the File->Import command
  2. Select as source type Code Composer Studio:Existing CCS/CCE Eclipse Projects
  3. Select an archive file
  4. Browse to the Randyp_DSPClockSpeed.zip file or enter the path to it
  5. Select the DSPClockSpeed project
  6. Click Finish

Since this program was built and archived from a workspace using CCSv4.2.4.00033 and Code Generation Tools 7.2.3, there may be some "housekeeping" needed to make your build and debug experience run smoothly. Please follow these steps to make sure the right tools are selected:

  1. In the Project Explorer window, right-click on the project folder name and select Properties, select General in the left pane
  2. Click the drop-down arrow for Variant: and select the device type that you are using; this project was built for the C674x, so you may need to change it to Generic C64x+ or Generic C66x
  3. Click the drop-down arrow for Compiler version: and select the latest version of CGT that you have. Earlier versions like 6.0.x may work but have not been tested (please comment here if you test them). If your latest version is not yet in the list, click More then Select tool from file-system and browse to the folder, such as C:\TI\Tools\C6000 Code Generation Tools 7.3.1, then click OK and OK.
  4. Click OK to save these changes

Build the Application

Each board or DSP may have different methods for configuring the device and the DSP's PLL or clock speed. Whatever steps must be taken will usually be done in a GEL script, or in boot code, or in an initialization/setup function at the beginning of the main function. It is your responsibility to make sure this initialization is done either outside this test program or inside this test program, under the comments starting with "System setup".

Build in CCSv4

Follow the steps below to get a successful build of the project.

  1. Select the DSPClockSpeed project, right-click and Set as Active Project.
  2. On the main icon row click the Build Active Project icon.

Build in CCSv5

Follow the steps below to get a successful build of the project.

  1. In the Project Explorer window, select the DSPClockSpeed project to make it the Active Project.
  2. On the main icon row click the "hammer" icon that says Build Debug for your project, or right-click on DSPClockSpeed and choose Build Project.

Load and Run the Application

After a successful build has been completed, follow these steps in the Debug Perspective to load and run the application:

Load and Run in CCSv4

  1. In a Target Configurations window, find the appropriate Target Configuration, then right-click on it and select Launch Selected Configuration
  2. On some heterogeneous devices like the OMAP-L138 or DaVinci DM8168, there may be some required steps to enable the DSP for debug. If so, please do those steps here, including any GEL Script functions that need to be executed.
  3. In the Debug Perspective, on the main icon row, click Connect Target to connect to the DSP. Please do any additional steps required to configured the DSP for the desired operation, including any GEL Script functions that need to be executed.
  4. On the main icon row, click Load Program and find DSPClockSpeed.out to load
  5. On the Debug window icon row, click Run to reach the in-code SWBP breakpoint
  6. Open or show the Local Window
  7. Find a clock or timer with visible seconds
  8. Click Run again
  9. Wait 10 seconds based on the clock or timer with visible seconds
  10. Click Halt
  11. Observe the CPU clock rate in the Local Window as shown below for the C674x DSP on an OMAP-L138 running at 300MHz; read the Value for the variable CPUClockMHz

CCSv4 Local Window for OMAP-L138 DSP @ 300MHz

Load and Run in CCSv5

  1. In a Target Configurations window, find the appropriate Target Configuration, then right-click on it and select Launch Selected Configuration
  2. On some heterogeneous devices like the OMAP-L138 or DaVinci DM8168, there may be some required steps to enable the DSP for debug. If so, please do those steps here, including any GEL Script functions that need to be executed.
  3. In the CCS Debug Perspective, on the main icon row, click Connect Target to connect to the DSP. Please do any additional steps required to configured the DSP for the desired operation, including any GEL Script functions that need to be executed.
  4. On the main icon row, click Load Program and find DSPClockSpeed.out to load
  5. On the Debug window icon row, click Run to reach the in-code SWBP breakpoint
  6. Open or show the Variables Window
  7. Find a clock or timer with visible seconds
  8. Click Run again
  9. Wait 10 seconds based on the clock or timer with visible seconds
  10. Click Halt
  11. Observe the CPU clock rate in the Variables Window as shown below for the C674x DSP on a DM8168 running at 800MHz; read the Value for the variable CPUClockMHz

CCSv5 Variables Window for DM8168 DSP @ 800MHz

Summary

The clock rate displayed will be close, usually within 5%. The accuracy depends mostly on your reaction times when measuring the 10 second delay. You can use longer delays and adjust your interpretation of the displayed counts accordingly.

This project provides a simple way to confirm that the clock speed settings you have implemented for your DSP are running at the correct frequency.

Another good application idea would be to toggle a pin or send a message through a communication channel, then count off 10G counts of the TSC counter, then toggle the pin again or send another message. The pin pulses or messages could be timed and compared to the expected value as a method to confirm that your DSP is running at the desired speed, but without using CCS or an emulator.