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.

bios6 timestamp_get32 API

Other Parts Discussed in Thread: SYSBIOS

Hi,

I'm migrating to BIOS 6 from BIOS 5 and have replaced the BIOS5 API CLK_gethtime with the BIOS6 API Timestamp_get32. I'm running the DSP's SYSBIOS clock example that sets up a timer function that is scheduled to run every 5 system ticks (i.e. 5 ms). Each interrupt I call Timestamp_get32 and compute and log the delta between the current value and the value obtained the previous interrupt. I expected the delta timestamp value to be 4,000, 000 every interrupt  (800, 000 * 5) as I'm running at 800 MHz and the clock is configured for 1000 microseconds per interrupt.  However, that's not what I measure. Instead the delta number of ticks between interrupts oscillates between 2,456, 784 and 1, 761, 940  +/- 100 ticks. The value returned from Clock_getTicks increases by 5 each interrupt. I don't understand why the delta value is different from what I expect. Is timerstamp_get32 the wrong function to replace CLK_gethtime, or am I missing something in the configuration?

FYI I'm running on a spectrum digital 816x EVM board that presumably is running at 800 MHz. Even if it were not running at that frequency, I still would expect the delta to be consistent from one interrupt to the next.

Thanks,

Jim

  • Jim,

    Which version of BIOS6 are you using?

    If you're running at 800Mhz for 5ms, I think you are very close to the threshold of Timestamp_get32() wrapping which means it probably is wrapping on you because the Timestamp most likely is not starting at or near 0.  Could try using Timerstamp_get64() and checking the high half?

    Judah

  • Judah,

    I'm running bios 6.31.04.27.

    If I'm not mistaken, a 32-bit timer incrementing at 8 MHz shouldn't wrap every 5 ms - I'd expect roughly 536 seconds per wrap. Still, I tried using Timestamp_get64. The delta remains the same. - oscillating between 2 values.

    Jim

  • Jim,

    Sorry, I realize I was off in my calculation.  I thought you were running at 800 Mhz?  So it would then take 5.368 seconds (for the timestamp) to wrap assuming you are running at the cpu speed....not 5 milliseconds.  I forgot to ask which core you are running on, but this is definitely not the problem.

    Judah

  • Jim --

    Can you try adding this to your .cfg file?


    var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
    Timer.anyMask = 0x0E; /* remove timer 0 and 4 from ANY pool */

     

    There seems to be an issue with timer3 and timer7 (logical timer 0 and 4) on the TI816x devices that is still under investigation.  These timers seem to tick 2x as fast as programmed  (and not equal in period).   This is covered by the following bug report.  We will likely employ the above workaround in a future BIOS to avoid using these timers for the Clock interrupt.

    SDOCM00081684|Committed|Shreyas Prasad|||DM8168: Timer0 interrupts at twice expected frequency|

    Regards,
    -Karl-

  • Karl,

    After adding those lines to my .cfg file, the number of ticks per interrupt as read from the Timestamp_get32() API is now consistent from one interrupt to the next: roughly  843742 +/-25. That seems better, but the number of ticks indicates a frequency of roughly 843 MHz rather than the expected 800 MHz.. I need to closer at the PLL settings to see if that makes sense.

    Is this problem on the 814x part too?

    How can I tell which timer BIOS will select - is it deterministic, and is there a possible conflict with timer usage on the ARM processor?

    Thanks,

    Jim

  • Karl,

    I looked at the main PLL registers values and it appears that the SYSCLK1 zone that provides the DSP clock is configured to run at 813.176471 MHz. I tried changing the BIOS.cpuFreq to 813176471 in my .cfg file, in the hope that Timestamp_get32 API would return an accurate count of CPU cycles over the timer interrupt period (now set to 1 ms). This was not to be, the Timestamp_get32 API is still returning values in the neighborhood of 843742 as before.

    How do I establish the timebase of the Timestamp package? In BIOS 5, the CLK_countspms API provided the number of timer ticks in one millisecond. I don't know how to interpret the values I'm reading from Timestamp.

    Thanks,

    Jim