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.

AM5728: DSP Clock Frequency and Task.sleep

Part Number: AM5728
Other Parts Discussed in Thread: SYSBIOS

Hi,

I am trying to calculate how much real-time it takes for a certain task. To do this I wanted to verify my timestamp implementation. Below you can find a simple task. This is the only task running on TI RTOS, The freq.lo value is read as 600.000.000 which is expected since that is what I entered to BIOS.cpuFreq.lo. However, the elapsed value reads about 575.000.000 ticks when RTOS returns to the task after Task_sleep(1000). Shouldn't the tick values be more than 600.000.000 and not less? Which one is false, my Timestamp_get32() or Task_sleep(1000)?

void mainTask(UArg arg0, UArg arg1)
{
    int* custom_count;
    UInt32 elapsed;
    UInt32 startTicks, endTicks;
    Types_FreqHz freq;

    custom_count = malloc(sizeof(int));
    *custom_count = 0;

    Timestamp_getFreq(&freq);
    appPrint("Freq: %d\n", freq.lo);
    while(1)
    {
        startTicks = Timestamp_get32();
        (*custom_count) = (*custom_count) + 1;

        appPrint("Count: %d\n", *custom_count);
        Task_sleep(1000);

        endTicks = Timestamp_get32();
        elapsed = endTicks - startTicks;
        appPrint("Your calculations took %d ticks to run.\n", elapsed );
    }
}