We've spend the day troubleshooting an issue with the hibernation module in the TM4C129XNCZAD micro that we are using. As you may recall, for this revision of our hardware we connected the HIB output pin to the 3.3V enable so the hibernation module controls the 3.3V rail.
Here is what we have learned about the issue we are seeing:
- If an RTC match value is set before going to hibernation, the micro wakes up after the desired duration, but the RTC value is zero after wake-up.
- If the power button is used manually enable the 3.3V rail before an RTC match, the micro wakes up, but the RTC value is zero.
- In both cases, the RTC sometimes stops ticking and remains at zero until all power is removed from the micro (3.3V and VBAT). In the other cases, it continues to count from zero.
Here is our function for entering hibernation. Are we doing something wrong when we enter hibernation that would cause the RTC to reset when the micro wakes up? Note that we have previously been using the RTC wake-up feature with the 3.3V rail on, and it works as expected. The datasheet mentions that the micro performs a POR when the 3.3V rails are applied…could this have something to do with it? Thanks for your help!
void HIB_EnterHibernation(uint32_t rtcWakeSec)
{
uint32_t ui32Status;
dprint(DB_HIBERNATE, "Preparing to hibernate with Rails OFF");
// a little delay to make sure the db messages go out
SysCtlDelay(4000000);
if (rtcWakeSec != 0)
{
// Wake up in rtcWakeSec seconds
HibernateRTCMatchSet(0, HibernateRTCGet() + rtcWakeSec);
HibernateWakeSet(HIBERNATE_WAKE_RTC);
}
else
{
// Never wake up from RTC (set duration to be way in the future)
// TODO – Ask Rob if there is a better way to hibernate without ever waking up?
HibernateRTCMatchSet(0, HibernateRTCGet() + 1000000);
HibernateWakeSet(HIBERNATE_WAKE_RTC);
}
// Clear any pending status.
ui32Status = HibernateIntStatus(0);
HibernateIntClear(ui32Status);
// Request hibernation
HibernateRequest();
// We may return from the above call. Need a loop here in case we're still executing.
while (1);
}