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.

RTOS/AM3352: Timestamp delta and realtime issues

Part Number: AM3352
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS


The test project I built is based on 3352 + TI-RTOS. I want to get the exact time interval for the program to run. 

1. in .cfg file, configure cpu freq as : BIOS.cpuFreq.lo = 300000000; //300Mhz

2. in one task , get freq as:

Types_FreqHz freq,freq2; 
Timestamp_getFreq(&freq);
BIOS_getCpuFreq(&freq2);

--->"freq.lo = 300000000 and freq2.lo = 300000000,    I don't know why these two values ​​are equal.( I see freq2.lo = 300Mhz, but ,freq.lo)"

UINT32 time1 = Timestamp_get32();
Task_sleep(100);
UINT32 time2 = Timestamp_get32();
UINT32 delta = time2 - time1;

--->"detla" different value  { 59968146   59978175   59942046  59950662  59943836 }.  why different?

and, real_time should be equal 0.1s,  but (deltla / freq.lo)  real_time=59968146/300000000 = 0.19989382 (s) ; like 0.19989382 /2 ,why?

3.in DMtimer Interrupt, 1ms cycle

Isr{

     UINT32 timestamp = Timestamp_get32();

     static UINT32 s_timestamp = timestamp;

     g_timestampDelta = timestamp - s_timestamp;

     s_timestamp = timestamp;

}

g_timestampDelta ,different value  { 599982   610108   600050  600052  599984 }.  why different?

real_time = 599982 / 300000000 ?,   bu not 1ms  the same question as in task.

 

Where is the problem?

different value  { 59968146   59978175   59942046  59950662  59943836 }.  why different?

  • Alan,

    We have looped in the TI RTOS experts to comment on this different timestamp result. Can you please describe your application in a little more detail ? Is there only one task in the application or is it possible that there is a task switch when you call Task_sleep

    How are you estimating the operation should take 0.1 s is this based on the published BIOS benchmarks? For your platform the timestamp provider as per Setting.xs in bios_6_73_01_01\packages\ti\sysbios\family\arm is
    timestampDelegate : "ti.sysbios.family.arm.a15.TimestampProvider",

    The module uses Cortex A PMU counter which is cycle accurate time stamp provider. One reason why this could be possible is that the MPU PLL may be set to 600 so PMU is running twice as fast as the BIOS.cpuFreq.lo that you are configuring. The Frequency in BIOS configuration needs to match what you have configured on the MPU PLL using either GEL file or bootloader code. What platform are you using and how are you setting up the device clocks.

    Regards,
    Rahul
  • Rahul ,


    Thank you for your answer.

    I can understand the different detla values ​​of timestamps in multiple tasks. but ,timer interrupt is a hwi , it should be same timestamp detla in every cycle.

    in cfg file: 

    var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
    var TimestampProvider = xdc.useModule('ti.sysbios.family.arm.a8.TimestampProvider');
    Timestamp.SupportProxy = TimestampProvider;

    Would you help point out the "MPU PLL may be set to 600" in the bootloader code .(ti\pdk_am335x_1_0_8\packages\ti\starterware\bootloader\src\am335x\sbl_am335x_platform_pll.c)