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.

millisecond value along with second_get() value?

Other Parts Discussed in Thread: CC3200, SYSBIOS

Hello Ti forum.

Is there a easy way to get an event or something like that, when the second service is incrementing the value? 

I have an system where i need a "timestamp with an accuracy of milliseconds. I thought about using the seconds service and a timer register to maintain the millisecond count. Because of the small drift in time when using the sys_tick i want to reset the timer register every time the second value is incremented.

Is it possible to get noticed when the second value i changing? 

Or do anyone have an better idea to accomplish this in another way? 

BR.

Henrik 

  • What platform or device are you on? Are you using TIRTOS, if so what version?
  • Hello judahvang.

    Sorry for the missing info.

    I´m using the SimpleLink Wi-Fi CC3200 LaunchPad and TI-RTOS version 2.11.1.09.
  • I´m still hoping to hear from one that can help me on this problem :)

    br
    Henrik
  • Hi Henrik,

    You should be able to use the cc32xx TimestampProvider to get your Timestamp in resolution of milliseconds.  You can add this to your .cfg file:

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

    In your c file, you can get seconds and milliseconds from the timestamp as follows, using the fact that the frequency of this timestamp counter is 32768:

        t = Timestamp_get32();
        seconds = t >> 15;
        msecs = (t & 0x7fff) * 1000 /32768

    You may also need to calculate an offset to add to the seconds value calculated above, depending on the value you passed to Seconds_set().  To calculate the offset, you could call Seconds_get() and Timestamp_get32(), and use the difference in seconds from these to functions.  You would only need to calculate a new offset after each call to Seconds_set().

    For simplification, I used Timestamp_get32(), but you may want to use Timestamp_get64() instead.

    Is this the type of thing you had in mind?

    Best regards,

        Janet