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.

The DSP runs at extremely low speed, Why?

Other Parts Discussed in Thread: DM3730

Hi everyone,
I am using DM3730 (having C64X+ in it) to run a simple for loop. What I see is that the DSP is running at very very low speed.
I am using Blackhawk USB560 BP emulator and EVAL version of CCSv4 (without BIOS). I run the following piece of code.
#include <stdio.h>
#include <time.h>

void main()
{
  int i, s1, s2, t;
  s1 = time(NULL);
  for(i = 0; i < 100000000; i++)
  {}
  s2 = time(NULL);
  t = s2 - s1;
  printf("t = %d s", t);
}
 
After executing this code, I see t = 14 s. It means that the DSP is running at 7 MHz. I would expect it to be 800 MHz. 
What causes the DSP to run this much slowly? Is it because I am using the EVAL version of CCS? Can anyone suggest me how I can fix it?
Besides, is there a way to learn the exact clock frequency of the DSP.
Best Regards,
Coskun

  • Hi Coskun,

    This is not a valid test to determine the processor speed. I'm assuming you got 7 MHz from 100,000,000/14s. The "for" loop you have is not going to take 100,000,000 cycles. Depending on your compiler options it could take a lot more (e.g. debug options) or almost none (e.g. optimization and the compiler sees you are doing nothing in the loop). The c64+ family has two 32-bit registers (TSCL and TSCH...where H is high and L is low). These registers maintain a 1-1 count of the cycles. To verify the CPU speed. Run the same test, but look at TSCL/TSCH at the start and end of the test. They should verify the frequency.

    For example. If TSCL/H were zero at the beginning, after 14s, TSCH and TSCL should be approximately 0x00000002 and 0x9B927000 (800,000,000 * 14).

    note: there are some rules with programically reading TSCL and TSCH (I think you have to read the L one first and then immediately read the H one). CCS handles this when look at the register view in CCS.

    Todd

  • Thanks for your reply Todd,

    Now I read the TSCL and TSCH registers and see that the DSP is actually running at slow speed.

    Now, I dont see 800,000,000 * 14 but I see much less than that value (about 1/10 of that value).

    Do I need to configure the PLL registers to enable the DSP to run at max speed? I looked at the user manual but could not figure out how to set the register for this purpose.

    Or, might there be any other thing that I should do?

     

    Thanks again.

    Best regards,

    Coskun

  • Coskun --

    Do you have a .gel file for that board?   Usually the .gel file has a command and logic to program the PLL.  This logic can be duplicated in C code and done on the target.

    -Karl-

  • In almost every scenario where performance is orders of magnitude less than expected, the root cause is cache/memory related.  In this case I suspect you have code/data in external memory and do not have the proper cache configuration.  Please see this article for more info:

    http://processors.wiki.ti.com/index.php/Enabling_64x%2B_Cache