I try to put controller into the hibernation mode, preserve a data before and restore a data after the code restart . But I have a trouble: I get an unexpected data after wake up. My code looke like this:
unsigned long static_array;
void main()
{
...
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
ROM_HibernateEnableExpClk(ROM_SysCtlClockGet());
if(ROM_HibernateIsActive())
{
ulStatus = ROM_HibernateIntStatus(0);
if(ulStatus & (HIBERNATE_INT_PIN_WAKE))
{
ROM_HibernateDataGet(&static_array, 1);
PulseLed(PIN_BLUE);
}
}
static_array++;
uart_write((char *)&static_array, 1); // verify the value of static_array variable
...
// put controller into hibernate mode
}
void hibernate_start(void)
{
...
ROM_HibernateDataSet(&static_array, 1);
PulseLed(PIN_RED);
...
}
I sure that hibernate mode work correctly. But after the processor waked up I always get from UART only 0x01, I expect an increasing value.