CC2652R7: How to use inbuild RTC for data logging purpose to get accurate timing

Part Number: CC2652R7

Tool/software:

1) I am required to log some sensor data into the inbuilt flash with accurate time stamps like 1 second by one second . (Better we can get date also )

Special Requirement need to use inbuild RTC cannot use clock or timer 

I found this example code in the fatsd example does anyone have a broad explanation how to decode the accurate time data within this code?

  • Hello Tharusha Hansima,

    I Hope you are doing well.

    We should be able to use the timer function here and have a global increment every second. Something like:

    Timer_Handle    handle;
    Timer_Params    params;
    Timer_Params_init(&params);
    params.periodUnits = Timer_PERIOD_HZ;
    params.period = 1;
    params.timerMode  = Timer_CONTINUOUS_CALLBACK;
    params.timerCallback = UserCallbackFunction;
    handle = Timer_open(CONFIG_TIMER0, &params);
    if (handle == NULL) {
        // Timer_open() failed
        while (1);
    }
    status = Timer_start(handle);
    if (status == Timer_STATUS_ERROR) {
        //Timer_start() failed
        while (1);
    }
    sleep(10000);
    Timer_stop(handle);

    Would this work for you? 

    Thanks,
    Alex F