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.

CC1310 + TI-RTOS: How to get high resolution timestamps

Other Parts Discussed in Thread: SYSBIOS

Hi

I use the following platform:

  • CC1310F128 + SmrtRF06 EB
  • CCS 6.1.2
  • TI-RTOS cc13xx_cc26xx_2_16_00_08
  • UIA 2_00_05_50

Further I use LoggingSetup (StopMode) and the Clock and Timestamp module. A clocked function toggles LEDs every 500 ms. With Timestamp_get32() and Log_info() I perform some benchmark and log the time differences of two timestamps.

The Execution Analysis shows results and in Live Session I see my log_info messages and benchmark results. So fare everything seems to work...

Now the issue is that the timestamps have the resolution of the RTC (32 kHz) hence all events (in Live session and Execution analysis) have a minimum time resolution of 31 us (1/32kHz). I know that by default the system clock (sys ticks) is running at 48 MHz and the timestamp at 32 KHz, so how can I manage to get timestamps with the high resolution of the system clock (which would be 20.8 ns compared to 31 us from the RTC)?

I tried the following:

/* ================ Clock configuration ================ */
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
Timestamp.SupportProxy = xdc.useModule('ti.sysbios.family.arm.m3.TimestampProvider');

Now the Timestamp_get32() timestamps logged with log_info (Main Logger) have the desired 20 ns resolution. But now the SYSBIOS System Logger misses many samples such that only HWI_start events are shown... I do not understand whats going wrong.

Below I added a screen shot of the resulting Live Session and Execution Graph:

Hope someone can help me to get this fixed...

  • Hi Lucky,

    You can try increasing the size of your Log buffer in the .cfg file:

    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    LoggingSetup.sysbiosLoggerSize = 12345;

    Best regards,

        Janet

  • Hi Janet


    I increased the buffer size to 10240 but get the same result.... The system operates as intended, LEDs are toggled and Main Logger outputs correct log_info messages.

    However, I noticed some strange behaviour. In ROV I can see the SYSBIOS System Logger and all the logged events from sequence 0 up to 312 but in the Live Session (and also Execution Graph) there are just around 40 SYSBIOS events shown and data loss is indicated (see screen shot below). It seems that not all SYSBIOS events are transferred to (or processed by) the Live Session & Execution Graph.

    Investigating the SYSBIOS events in the screen shot below it can be seen that up to seq. 15 everything is ok but after seq. 15 the data loss starts.... hmmm

    In Live Session at the beginning  the clocked HWI has intNum 20 (RTC) and from seq. 15 on it is intNum 15 (SysTick).
    In ROV still both HWIs occurr but intNum 15 (SysTick) seems to do nothing and intNum 20 (RTC) provides the ticks and posts the SWI whick calls the clocked function (ledToggleAllClk() in my case)...

    So SysTick timer is running to provide timestamps and the RTC timer is running to provide ticks and clocked function - this does somehow not make sense to me...

    • The RTC has 32-bit resolution while SysTick only has 24-bit resolution. Could this be a problem?
    • When all events are logged and visible in the ROV why are they not shown in Live Session & Execution graph?

  • Attached you can find the used .cfg file:

    2330.empty.cfg

  • Hi Lucky,

    I don't think the issue is the 24-bit SysTick counter.  The m3 timer module maintains a rollover count, which goes into the Timestamp.  Did you disable Power in the board file:

    const PowerCC26XX_Config PowerCC26XX_config = {
        .policyInitFxn      = NULL,
        .policyFxn          = &PowerCC26XX_standbyPolicy,
        .calibrateFxn       = &PowerCC26XX_calibrate,
        .enablePolicy       = FALSE, //TRUE,
        .calibrateRCOSC_LF  = TRUE,
        .calibrateRCOSC_HF  = TRUE,
    };

    Best regards,

        Janet

  • Hi Janet

    Unfortunatelly this did not help.

    The power policy was enabled, so I changed it like suggested in the CC1310DK_7xD.c file but the behaviour is still the same - data loss in Live Session & Execution Graph (in ROV I still see all the logged events - none missing...).

  • Hi Lucky,

    Can you replace the m3 TimestampProvider with the lm4 TimestampProvider?  In your .cfg file:

    var Timestamp = xdc.useModule('xdc.runtime.Timestamp');

    /* set timestamp proxy */
    Timestamp.SupportProxy = xdc.useModule('ti.sysbios.family.arm.lm4.TimestampProvider');

    The problem turns out that logging the Hwi event for the m3 Timer rollover introduced an extra 'rollover' count to the timestamp for the beginning of that Hwi.  The next timestamp is back down as it should be.  You will see this in your ROV veiw for the Log events with sequence numbers 15 and 38:

    When the Timestamps are out of order like that, System Analyzer does not display the events.

    We looked at the lm4 TimestampProver code and it does not have this problem.  I also tried this with the lm4 TimestampProvider in the empty.cfg file and the results looked ok.  But please let me know if you still have issues.

    I will file a bug against BIOS for the lm3 TimestampProvider.  Thanks for your patience in waiting for us to find the problem

    Best regards,

        Janet

  • Hi Janet

    Great work! This solves the issues and it works perfectly now. Timestamps are in order and have 20ns resolution. Everything is displayed in the Live Session and Execution graph like expected. It works for power policy enabled or disabled...

    Thanks for your help.

    Best regards,
    Lucky