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/MSP432P401R: Posix Timer - Get time is different than set time

Part Number: MSP432P401R


Tool/software: TI-RTOS

Hello

I am having a problem with a timer on MSP432. I am using POSIX and the below product versions.

MSP432SDK - V1.40.1.00 (I also tested with 1.50 and 1.60 same behavior)

Simplelink SDK WiFi - V1.50.0.38

TI-RTOS for SimpleLink - V2.13.1.09

I have multiple timers in my system, the ones that have small values and intervals are working fine.
One of my timers needs to be called every 22hours but for some reason it is being called every 30 minutes.

I put a timer_gettime directly after my timer_settime call and it shows that the time was set for 30 minutes not 22hours. Below are relevant code snippets.

    pthread_attr_init(&pAttrs);                                     //< Initialize struct to default values
    pthread_attr_setstacksize(&pAttrs, 512);                        //< Set the timer task size
    sigEvt.sigev_notify = SIGEV_THREAD;
    sigEvt.sigev_notify_function =   &token_callback_fnx;
    sigEvt.sigev_notify_attributes = &pAttrs;
    timer_create(CLOCK_REALTIME, &sigEvt, &tokenTimer);             //Create timeout timer, also tried CLOCK_MONOTONIC

void setup_token_timer()
{
    struct itimerspec token_its;
    token_its.it_interval.tv_sec = 79200;                           //22Hours 
    token_its.it_interval.tv_nsec = 0;
    token_its.it_value.tv_sec = 79200;                              //22Hours
    token_its.it_value.tv_nsec = 0;
    timer_settime(tokenTimer, 0, &token_its, NULL);


    timer_gettime(tokenTimer, &token_its);
    LOG_MESSAGE("Timer value \r\n");                               //Just for breakpoint, here token_its.it_interval.tv_sec is 1890 not 79200
                                                                   //same for token_its.it_value.tv_sec
}

The callback function "token_callback_fnx" is being called every 30 minutes. I don't think the code for it is relevant.

Update 1:

Adding the cfg part for the TI-RTOS clock. I am using the RTC as tick provider with 250ms ticks. 

/* ================ Clock configuration ================ */
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var System = xdc.useModule('xdc.runtime.System');
var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
/*
 * Default value is family dependent. For example, Linux systems often only
 * support a minimum period of 10000 us and multiples of 10000 us.
 * TI platforms have a default of 1000 us.
 */
Clock.tickSource = Clock.TickSource_USER;	// u360 user code will handle the RTOS ticking
Clock.tickPeriod = 250000;                  // The tick will be 250ms

I appreciate any help. Thank you in advance.

**Attention** This is a public forum