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.

TM4C1290NCPDT: Hibernation Module Initialization

Part Number: TM4C1290NCPDT

I'm attempting to initialize the hibernation module in order to use the RTC functionality on the TM4C1290NCPDT and running into a lot of trouble.

Our design incorporates an external 32.768 kHz oscillator. However, while debugging my issues I discovered that our board fab had some quality issues and during my initial struggles what I really had was a 3V VBAT short to XOSC0. I've since removed the oscillator and the short such that XOSC0 and XOSC1 are now floating (no connection).

The relevant code is below. In the current state of things, the processor gets stuck in an infinite loop in the HibernateEnableExpClk(sys_clock) call. I've stepped through the assembly and can see that it attempts to flag CLK32EN in the HIBCTL register and wait for the write complete flag (WRC). However, all the write ends up doing is resetting the WRC bit which never goes high again leading to the code getting stuck waiting for the WRC bit and thus the infinite loop.

What am I doing wrong here?

sys_clock = SysCtlClockFreqSet(SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 25000000);

SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
{
  // wait for hibernate module to initialize
}
if(!HibernateIsActive())
{
  HibernateEnableExpClk(sys_clock);
  HibernateClockConfig(HIBERNATE_OSC_DISABLE);
  HibernateRTCEnable();
  HibernateCounterMode(HIBERNATE_COUNTER_24HR);
}

  • I think the problem is that since the default value of the HIBCTL register is OSCSEL=0 (external 32KH osc source), when you call HiberanateEnableExpClk(), the register write is waiting to be synchronized to the external 32KHz crystal. Since in your hardware, you do not have a functional external 32KHz crystal, the write never completes and the WRC bit stays low. This should resolve once your hardware is fixed.
  • Thank you Bob. You were absolutely correct. The problem was the OSCSEL bit in the HIBCTL register.

    I was able to initialize the hibernation module using the internal oscillator by manually setting the CLK32EN bit and the OSCSEL bits in a single write rather than using the TivaWare Library API Calls to initialize the hibernation module. Despite the inaccuracy of the RTC running off of the internal low frequency oscillator, I am now able to continue development while our sample boards are reworked. Below is my modified code for future Googlers.

      SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
      while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
      {
        // wait for hibernate module to initialize
      }
      if(!HibernateIsActive())
      {
        tempRegVal = HWREG(HIB_CTL);
        while(!(tempRegVal & HIB_CTL_WRC))
        {
          // wait for the WRC bit to indicate the register is ready to be written
          tempRegVal = HWREG(HIB_CTL);
        }
        HWREG(HIB_CTL) = tempRegVal | HIB_CTL_OSCSEL | HIB_CTL_CLK32EN;
        HibernateRTCEnable();
        HibernateCounterMode(HIBERNATE_COUNTER_24HR);
      }

  • Thank you for thinking of others and posting your code. If you would select the "Verify Answer" button on my suggested answer post above, that will also help others find this post with your solution.