Other Parts Discussed in Thread: EK-TM4C1294XL
System Details:
-
OS - Microsoft Windows 7 Professional Version 6.1.7601 Service Pack 1 Build 7601
-
Processor - Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
-
BIOS Version/Date - Dell Inc. A13, 3/27/2013
CCS Details:
- Version: 6.1.1.00022
- TivaWare_C_Series-2.1.0.12573
- Launchpad: EK-TM4C1294XL
Hello all,
I am trying to get the hibernation module to run in a simple way. I have a timer that is consistently fed and when a certain event occurs, the timer is no longer fed and expires. Once expired I need the device to enter hibernation mode and wake only when the 'Wake' pin is asserted. I don't need any internal clocks running, and the device is powered by VDD. I have an initialization function that I call in main() and the 'enter_hibernation' function is called when the previously mentioned timer expires. Here is what I have:
void sleepInit(void)
{
// Enable the hibernate module.
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
// Set the VDD3ON bit to allert that the chip is powered by VDD
HibernateGPIORetentionEnable();
// Configure Hibernate module clock.
HibernateEnableExpClk(ui32SysClock);
HibernateRTCDisable(); // We are not using the RTC feature in the hibernation module
// Configure the module clock source.
HibernateClockConfig(HIBERNATE_OSC_DISABLE); // No oscilator used in the hibernate madule
// Configure GPIO used as Hibernate wake source
// GPIOPadConfigSet(GPIO_PORTK_BASE, GPIO_PIN_7, GPIO_STRENGTH_2MA,
// (GPIO_PIN_TYPE_WAKE_LOW | GPIO_PIN_TYPE_STD_WPU));
}
void Sys_sleep(void)
{
uint32_t ui32Status;
// Perform system checks before sleep
// Read and clear any status bits that might have been set since
// last clearing them.
ui32Status = HibernateIntStatus(0);
HibernateIntClear(ui32Status);
// Configure Hibernate wake sources.
HibernateWakeSet(HIBERNATE_WAKE_PIN); // Wake on WAKE-PIN assertion
// Request Hibernation.
HibernateRequest();
// Wait for a while for hibernate to activate. It should never get
// past this point.
SysCtlDelay(100);
// If it ever gets here, store the text, that informs the user on
// what to do, into the respective widget buffers.
printf("The controller did not enter hibernate. \n");
// Wait here.
while(1)
{
}
}
The problem is with _HibernateWriteComplete() which is called from within a number of the above functions and shown below:
//*****************************************************************************
//
//! \internal
//!
//! Polls until the write complete (WRC) bit in the hibernate control register
//! is set.
//!
//! \param None.
//!
//! The Hibernation module provides an indication when any write is completed.
//! This mechanism is used to pace writes to the module. This function merely
//! polls this bit and returns as soon as it is set. At this point, it is safe
//! to perform another write to the module.
//!
//! \return None.
//
//*****************************************************************************
static void
_HibernateWriteComplete(void)
{
//
// Spin until the write complete bit is set.
//
while(!(HWREG(HIB_CTL) & HIB_CTL_WRC))
{
}
}
This function hangs on the while loop at various times. Sometimes it will hang when called from within the initialization function, and sometimes it will hang when it is called form the Sys_sleep function.
I cannot figure out why it is hanging. Please let me know if there is anything you find that would help me.
Thank you,
Mitchell