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.

TM4C129XNCZAD: Real Time Clock lagging

Part Number: TM4C129XNCZAD

Dear Sir,

We have developed our own PCB board with TM4C129XCNZAD and using the inbuilt Hibernate RTC feature of processor.

Initialization code 

void Hibernate_RTC_Init(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);

HibernateEnableExpClk(ui32SysClock);
HibernateClockConfig(HIBERNATE_OSC_LFIOSC);

// Enable RTC mode.
HibernateRTCEnable();
// Configure the hibernate module counter to 24-hour calendar mode.
HibernateCounterMode(HIBERNATE_COUNTER_24HR);
}

We are using already available DateTime.C  file of Ti example and also  DateTimeDisplayGet  function  for fetching  date time .

We have also connected 3V  Coin battery to the VBAT pin to maintain calander.

Date Time setting and Reading is fine at that moment. It is synchronized with system Clock of PC.

We keep board  OFF for more than 12 hour  and found that  there is lagging in  time by 1 hour.

Why it is  lagging?

  • Hi Rajesh,

     - Can you run the TivaWare hibernate_calendar example on your custom board? Perhaps you need to modify it so that it will go hibernate for a longer period of time. Can you repeat the same problem? I just wanted to make sure if there is anything wrong with your code. If you can repeat the same problem using TivaWare example then we need to investigate your hardware.

    - Can you run your code on the LaunchPad. Can you repeat the same problem?

    - Running your own code on your custom board but only keep the board off for 1.5hours, 3 hours and 6 hours. Do you see the time lagging proportionally. In another word, do you see the time lag by 1/2 hour if you keep the board off for 6 hours. Likewise, time lag for 1/4 hours if the board is turned off for 3 hours?

  • Hi Rajesh,

     - Can you run the TivaWare hibernate_calendar example on your custom board? Perhaps you need to modify it so that it will go hibernate for a longer period of time. Can you repeat the same problem? I just wanted to make sure if there is anything wrong with your code. If you can repeat the same problem using TivaWare example then we need to investigate your hardware.

    - Can you run your code on the LaunchPad. Can you repeat the same problem?

    - Running your own code on your custom board but only keep the board off for 1.5hours, 3 hours and 6 hours. Do you see the time lagging proportionally? In another word, do you see the time lag by 1/2 hour if you keep the board off for 6 hours. Likewise, will you see a time lag of 1/4 hour if the board is turned off for 3 hours? I think by doing this experiment, we can have a better idea at what happened. 

  • Dear Sir,

    We  have carry same experiment in TM4C129XCNZAD development board and sump the 

    Connected the 3V battery @VBAT pin.

    We have set the time 07:10:10 P.M  and synchronize with  system  time  and switch off the the board.

    Now started board around 14 hours and check with system time and found that 15-16 minute lead in time instead of lag compare to system time.

    Why it is so?

  • Hi Rajesh,

     Thank you for providing data points from the development board. Your description tells me that the RTC is running too fast in the development board and too slow in your own board. Please refer to the datasheet on how to use the RTC trim to compensate for too-fast or too-slow RTC clock. This below post also has the same discussion. https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/728026/tm4c123gh6pz-using-the-rtc-with-the-trim-register?tisearch=e2e-sitesearch&keymatch=RTC%2520trim#

      I will suggest you start perhaps with 1minute of hibernate time and see how much to compensate using trim. Once you get the 1 minute to correctly compensate then increase the hibernation time to longer duration like 10min. Don't start with hibernation time like 12 hours as you need to wait too long for each experiment.