Hello
I tried to measure the CPU speed by running the code below and measure the time it get to stop in the break point (the while(1) command at the end)
void main(void)
{
volatile unsigned int dlyCount,counter=0;
unsigned long long ullTimeStart, ullTimeDiff, ullTimeEnd;
TSCL = 0;
ullTimeStart = TSCL;
ullTimeStart += (unsigned long long)TSCH<<32;
while(1)
{
counter++;
for (dlyCount=0;dlyCount<100000;dlyCount++);
if (counter>10000)
break;
ullTimeEnd = TSCL;
ullTimeEnd += (unsigned long long)TSCH<<32;
ullTimeDiff = ullTimeEnd - ullTimeStart;
};
while(1); //breakpoint
}
the time its take to arrive to the breakpoint is 64 second and the ullTimeDiff =19,000,620,000.
I run this code on C6748 LCDK board and I use the LCDK gel file that configure the cpu clock to 300MHZ.
when I look on the assembly code, the for command is done on a single instruction, this mean that for 100000*10000 loops it will take 1000000000 * 3.3nsec= 3.3sec insted it takes 64sec - 20 times longer.
The ullTimeDiff seems to be correct.
what can be the reason for this delay?