I am using the TM4C123G7H6PGEI on a custom board. My long term goal is to wake the chip from hibernation using an EXTERNAL real time clock. I am currently trying to successfully put the device to sleep and wake it by asserting the wake pin which I manually toggle with a wire.
When I request hibernation, the request is ignored and I enter a backup while(1) loop. Based on the datasheet, the only reason to be ignored in my case is if I don't set the PINWEN register in HIB_CTL, which I do.
I am using a XDS200 debugger, and powering the board from an external 4.0 V source. Does anything in my code stand out that would be causing this issue? More importantly, is there a register I can inspect that tells me why I am denied hibernation?
int main(void)
{
// Clock
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ);
//Systick
SysTickPeriodSet(SysCtlClockGet() / 100);
SysTickIntEnable();
SysTickEnable();
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
SysTickWait(10);
HibernateEnableExpClk(SysCtlClockGet());
SysTickWait(10);
HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
SysTickWait(10);
HibernateWakeSet(HIBERNATE_WAKE_PIN);
SysTickWait(10);
HibernateRequest();
// Give it time to activate, it should never get past this wait.
SysTickWait(100);
while(1)
{
}
}
I know I should have a method of detecting why the device was RESET following hibernation, clear interrupts, but I am trying to keep the software simple until I can at least enter hibernation mode.