Tool/software: TI-RTOS
Hello,
for the purpose of debugging/benchmarking I am using the Timestamp module from the SYS/BIOS.
I am able to build and to the debug the project.
But, when I calculate the timespan I have an error of 10%.
I am using the following code for the calculation:
Types_FreqHz FreqTmStmp; // Timestamp frequency Types_FreqHz FreqCpu; // BIOS frequency float factor; // Clock ratio cpu/timestamp float CycleTime=0.0; // Cycle time of cpu Bits32 stampOld=0, stampNew=0, delta=0; Timestamp_getFreq( &FreqTmStmp ); BIOS_getCpuFreq( &FreqCpu ); factor = (float)FreqCpu.lo / (float)FreqTmStmp.lo; // calc cycletime in ps CycleTime = 1 / ((float)FreqCpu.lo/1000000000000); stampNew = Timestamp_get32(); delta = stampNew - stampOld; stampOld = stampNew; timespan = ((float)delta*CycleTime)/1000000) //in microseconds
When I should measure a Timespan of approximately 4800us, I get a value of 5100-5200us.
Both, the CPU-Freq. and the Timestamp-Freq. are at 550MHz
Maybe someone can tell me the reason for the wrong Timestamp-Cycles?!
PS: Within this timespan it is not a problem of an overflow.