I am trying to allow Wake pin to be used for both my power off and power on button on TM4C129ENCPDT processor.
To allow me to monitor when the wake pin is released I put one on the GPIO wake pins Port K 4 in parallel with the wake pin.
I did this thinking that since it can also be enabled as a wake source it must be connected internally to the hibernate supply.
However I am finding that when I put the device to sleep, it immediately wakes up.
When I look at the Wake / Port K4 pins I see a short pulse to ground as soon as I go to hibernate, which of course wakes me up again.
I am thinking that either the hibernate wake GPIO pins cannot be used when the 3.3V is switched off or there is something missing in my initialisation of the GPIO pin to wake. Below is my code from when I go into hibernate.
// ON / OFF Button pressed
if (HWREG(HIB_RIS) & HIB_RIS_EXTW)
{
uint8_t debounce = 100;
// Wait until WAKE pin is released
do
{
Task_sleep(10);
if (!GPIO_read(Board_WAKE))
debounce = 80;
else
debounce--;
}
while (debounce);
ui32Status = HibernateIntStatus(0);
HibernateIntClear(ui32Status);
// Configure Hibernate module clock.
HibernateEnableExpClk(HIBERNATE_OSC_HIGHDRIVE);
// Enable RTC mode.
HibernateRTCEnable();
// Configure the hibernate module counter to 24-hour calendar mode.
HibernateCounterMode(HIBERNATE_COUNTER_24HR);
// Enable GPIO Retention
HibernateGPIORetentionEnable();
// Configure Hibernate wake sources.
HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RESET | HIBERNATE_WAKE_GPIO);
// Port K4 allows wake on Low
GPIOPinTypeWakeLow(GPIO_PORTK_BASE, GPIO_PIN_4);
// Request Hibernation.
HibernateRequest();
// Wait for a while for hibernate to activate.
// It should never get past this point.
SysCtlDelay(500);
}