Part Number: TM4C1294NCZAD
Hello
I'm trying to set my MCU (Tiva TM4C1294NCZAD) in deep sleep and then wake up from an external button. I started from sleep_modes example, and I wrote the "go to sleep" function as:
void GoToSleep()
{
/* Set the clocking for Deep-Sleep.
* Power down the PIOSC & MOSC to save power and run from the
* internal 30kHz osc.
*/
SysCtlDeepSleepClockConfigSet(1, (SYSCTL_DSLP_OSC_INT30 |
SYSCTL_DSLP_PIOSC_PD | SYSCTL_DSLP_MOSC_PD));
/* Enable the Button Port in Deep-Sleep Mode and auto clock gating */
SysCtlPeripheralClockGating(true);
SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOK);
/* Set LDO to 1.10V in Deep-Sleep. */
SysCtlLDODeepSleepSet(SYSCTL_LDO_1_10V);
/* Set Flash & SRAM to Low Power in Deep-Sleep Mode. */
SysCtlDeepSleepPowerSet(SYSCTL_FLASH_LOW_POWER | SYSCTL_SRAM_LOW_POWER);
/* FreeRTOS function to suspende scheduler */
vTaskSuspendAll();
SysCtlDeepSleep();
}
I enable only GPIO K port in deep-sleep because my button is connected to pin K5. its associated isr is the following:
static int test = 0;
void BUTTON_Handler(uint32_t index)
{
if(!test)
{
GoToSleep();
test = 1;
}
else
HAL_System_Reset();
}
When I press the button the first time, MCU correctly goes in deep-sleep state. But then, whenever I press the button, MCU never wakes up! I never the see system reset, neither consumptions increase, so I assume it doesn't return to run mode. Am i missing anything in this procedure?
Thank you