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.

CC3235S: Time synchronization for NWP

Part Number: CC3235S


Hi,

After connection to network using sl_WlanConnect(), I do startSNTP() and get the current UTC time and set same to NWP. I am using startsntp.c from TI SDK for function startSNTP(). Hereafter, I use below code to get UTC time:

_i8 configOpt = SL_DEVICE_GENERAL_DATE_TIME;
SlDateTime_t dt;

sl_DeviceGet(SL_DEVICE_GENERAL, &configOpt,
sizeof(SlDateTime_t), (unsigned char *)(&dt));

Do I need to set NWP time in periodic manner to keep it's clock synchronized to network time? Or it does this by itself?

Thanks,

Pradeep

  • Hi,

    There is no need to periodically set the time.

    The time is set in a dedicated file of the filesystem and read upon restart.

    Do you see a different behavior?

    Regards,

    Shlomi

  • Hi,

    I see default time (1st Jan 2013, 00:00) coming back after reset (power supply is still ON). When I give reset pulse to CC3235S module and read time using the code snippet I have given above then I get default time.  I have to connect back to network and startSNTP() to get the time again.

    Is there anyway where I can retain the time even after reset?

    Thanks,

    Pradeep

  • Hi,

    It should be persistent, I checked it myself.

    Can you try the persistency flag? see code below.

    _i16 configLen = sizeof(_u8);
    _u8 persistent;
    _i8 configOpt = SL_DEVICE_GENERAL_PERSISTENT;
    sl_DeviceGet(SL_DEVICE_GENERAL, &configOpt, &configLen, &persistent);

    Regards,

    Shlomi

  • Hi,

    Your code shows sl_DeviceGet(). I think this will get the status of persistent flag, right?

    You want me to check persistant flag value or you want me to set persistant flag using below code? 

    _u8 persistent = 1;

    Status = sl_DeviceSet(SL_DEVICE_GENERAL, SL_DEVICE_GENERAL_PERSISTENT, sizeof(_u8), (_u8*) (&persistent));

    I tried setting persistent flag using above code but that does not help. After reset, if I read time then it returns to default value.

    Thanks,

    Pradeep

  • Hi,

    I understand where the confusion is coming from.

    First, yes, I just wanted you to read the persistence flag to make sure the data and time is stored on the filesystem.

    The way it works (and it appears also on the NWP user guide) is that the RTC is used as a reference to the date and time. The RTC is a continuous counter which is active even during hibernation but resets after shutdown. So as long as you set the date and time and go to hibernation (i.e. sl_Stop() followed by sl_Start()), you should be OK.

    However, if you go to shutdown, then the RTC value gets reset and then the data and time would also get reset to the default Jan 1st 2013.

    Regards,

    Shlomi