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.

Compiler/EK-TM4C123GXL: EK-TM4C123GXL

Part Number: EK-TM4C123GXL

Tool/software: TI C/C++ Compiler

Hi all:

I had issue about RTC follow is my test
platform : EK-TM4C123GXL
RTOS:TI RTOS Tivac 2 16 00 08
IDE:
Code Composer Studio 7.3.0
XDCtools 3.32.0.06_core3
Compiler TI v16.9.4.LTS

void InitHibernation(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
//
// Wait for the Hibernate module to be ready.
//
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
{
}
//
// Determine if the Hibernation module is active.
//

HibernateEnableExpClk(SysCtlClockGet());
// Configure the clock source for Hibernation module and enable the
// RTC feature.
//
HibernateClockConfig(HIBERNATE_OSC_HIGHDRIVE);
HibernateRTCEnable();
}

and i print the HibernateRTCGet() value to console.  Follow is my log. 

2018/5/23 17:22:30 [RX] - RTC:172 <CR><LF>

2018/5/24 09:20:25 [RX] - RTC:58329 <CR><LF>

58329 - 172 = 58157 = 16 h  09 m 17 s

 2018/5/23 17:22:30 + 16 h 09 m 17 s

= 2018/5/24 09:31:47

 over the actual time 11 m 22 s

Is any RTC register setting wrong? or need to be set?

Thank you.

  • Try using HibernateRTCSet(counter value). I think it should do the trick.

  • I think the question is why the RTC module is not accurate and how to improve it 

    register setting ?? or other??

  • Sorry, I confused some things, my bad. In that case, I would try to change HibernateClockConfig(HIBERNATE_OSC_HIGHDRIVE) to HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE), although I believe the LP has 24pF filter capacitors.

    I've a code that use interrupts, in the case you want to verify if still have accuracy problems with it...

    uint32_t g_sec = 0;
    
    void config_HibernateRTC(void)
    {
        //set hibernate clock
        MAP_HibernateEnableExpClk(MAP_SysCtlClockGet());
    
        //TODO: Change to HIBERNATE_OSC_LOWDRIVE
        MAP_HibernateClockConfig(HIBERNATE_OSC_HIGHDRIVE);
    
        //set counter to 0
        MAP_HibernateRTCSet(0);
    
        //match = 0 when hibernate counter reaches 1
        HibernateRTCMatchSet(0, MAP_HibernateRTCGet() + 1);
    
        //deactivate and clear interrupts
        MAP_IntDisable(INT_HIBERNATE);
        MAP_HibernateIntDisable(HIBERNATE_INT_RTC_MATCH_0);
        MAP_IntPendClear(INT_HIBERNATE);
        MAP_HibernateIntClear(HIBERNATE_INT_RTC_MATCH_0);
    
        //generate interrupt when match = 0
        //enable interrupts
        MAP_HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);
        MAP_IntEnable(INT_HIBERNATE);
        
        MAP_HibernateRTCEnable();
    }
    
    void HibernateRTCIntHandler(void)
    {
        //clear interrupt
        MAP_HibernateIntClear(HIBERNATE_INT_RTC_MATCH_0);
    
        g_sec++;
    
        //reset counter
        MAP_HibernateRTCSet(0);
    }