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.

CCS/CC2650MODA: Real Time Clock restarts on reset. How is it possible to use it with watchdog.

Part Number: CC2650MODA


Tool/software: Code Composer Studio

Hi averyone:

I am using the CC2650MODA module and must add to it the real time clock. I loocked at manual and other forums how to do this. I get the time by the function "time()". The time is converted from the seconds by the function "localtime()". Everything is Ok, but there is one problem that I cannot solve: When I press the reset button the modul starts the time from beginning. In the Manual is written that time must be initilized to spetial time befor it can be used. But if I don't do any time initilization the time-counting doen't continue from the previous state , but instean of it it starts from the zero. I understand that the processor sets the default values on powering up or on the reset, but if I understand correctly the RTC, mustn't be reseted on reset otherwize if the watchdog will give the emergnecy reset the RTC time will be restarted too.

How is it possible to solve this problem.

Best regards

Boris Fridman.

  • Hello Boris,

    If the wireless MCU is reset, then the watchdog will need to be reinitialized as well before it will reset the MCU. I'm not sure what your concern is here, did you demonstrate a problem on your board related to this question?

    Best wishes
  • Hi, JXS,

    I don't explain the watchdog problem, but the Real Time Clock's. The RTC problem is that it resets. 

    The part of the code:

    //  Global variables:

    UInt32 t;
    time_t t1;
    struct tm *ltm;
    char *curTime;

    ...

    // In the loop code:

    t1 = time(NULL);
    ltm = localtime(&t1);
    curTime = asctime(ltm);
    System_printf("Time(GMT): %s\n\r", curTime);  // Printing to debugging terminal
    System_flush();

    uartTxBufferOffset = System_sprintf(uartTxBuffer,"Time(GMT): %s\n\r", curTime);    
    UART_write(UartHandle, uartTxBuffer, uartTxBufferOffset);      // Printing to UART terminal

    
    

    The data in terminal is shown so:


    Time(GMT): Mon Jan 1 00:00:01 1900

    Time(GMT): Mon Jan 1 00:00:02 1900

    Time(GMT): Mon Jan 1 00:00:03 1900

    Time(GMT): Mon Jan 1 00:00:04 1900

    Time(GMT): Mon Jan 1 00:00:05 1900

    Time(GMT): Mon Jan 1 00:00:06 1900

    Time(GMT): Mon Jan 1 00:00:07 1900

    Time(GMT): Mon Jan 1 00:00:08 1900

    Time(GMT): Mon Jan 1 00:00:09 1900

    Making reset

    Time(GMT): Mon Jan 1 00:00:01 1900  // After reset the clock starts from the zero instead of continuing from the last state

    Time(GMT): Mon Jan 1 00:00:02 1900

    Time(GMT): Mon Jan 1 00:00:03 1900

    Time(GMT): Mon Jan 1 00:00:04 1900

    Time(GMT): Mon Jan 1 00:00:05 1900

    Time(GMT): Mon Jan 1 00:00:06 1900

    Time(GMT): Mon Jan 1 00:00:07 1900

    Time(GMT): Mon Jan 1 00:00:08 1900

    Time(GMT): Mon Jan 1 00:00:09 1900

    From this log you can see that the clock restarts at the reset. That means if the program will be restarted by the watchdog the time in RTC will be incorrect.

  • Hi Boris,

    As noted in the TRM (SWCU117, Rev H cited), "The counter starts from 0 when enabled following power up of the AON_RTC". From FIgure 6-3, the AON_RTC is powered by the AON_VD on which "AON_VD is reset by a system reset. For details, see Section 6.7.1.".

    So what you show is expected behaviour when a reset occurs.

    Best wishes
  • Hi, JXS,
    So if I understood you and the manual correctly the reset coused by the watdog will restart the RTC too?
    Must be the RTC readjusted even after the hot, watchdog reset?

    Best regards
    Boris Fridman