This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Hibernation Tiva C series through GPIO

Hello y'all,

I am trying to put my micro controller in hibernation mode when PD0 is low and wake it up when PD0 is high. Here is my code, and I don't know why this is not working. Please help me out.

Thank you in advance

#include <stdint.h>
#include <stdbool.h>
#include "utils/ustdlib.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
#include "driverlib/debug.h"
#include "driverlib/hibernate.h"
#include "driverlib/gpio.h"
int main(void)
{
	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
	//GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x08);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
	HibernateEnableExpClk(SysCtlClockGet());
	HibernateGPIORetentionEnable();
	SysCtlDelay(64000000);
	HibernateWakeSet(HIBERNATE_WAKE_GPIO|HIBERNATE_WAKE_PIN);

	GPIOPinTypeWakeHigh(GPIO_PORTD_BASE, GPIO_PIN_0);
	//GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3, 0x00);
	//HibernateGPIORetentionDisable();

	HibernateRequest();
	while(1)
	{
	}
}

  • Hello Zikra

    GPIO Pin Wake up is not available on TM4C123 devices. It is only available on TM4C129x device.

    On TM4C123 the valid source of wakeup from Hibernate is Pin Wake (WAKE_N dedicated pin) and RTC Match.

    Regards
    Amit
  • Hi Amit, 

    Thank you for your reply. What would you suggest me then to do in order to wake up the launchpad when it receives high input from an external sensor? I tried connecting the sensor to the dedicated wake pin, but that was very unstable. It woke from the hibernation, but every second, it was switching back to hibernation for some milliseconds.

    Please advice.

    Thank you

    Zikra Toure

  • Hello Zikra,

    Ideally in such a case the Sensor must send a Active Low signal to the MCU to wake it up from hibernate mode. It depends on the manner in which the Hibernate code is written. In this case the device will wake up and go back to hibernate (based on the code in the first post)

    Regards
    Amit
  • Hello All,

    I am trying to learn hibernate mode for tm123gxl launchpad.

    I am trying to understand proper way to get it into the hibernate mode.

    I hope giving ground to wake pin will bring out my MCU from Hibernate Mode.

    What I am afraid of is if I am not putting it properly in hibernate mode I might damage my launchpad and wont be able to bring it out of hibernate mode.

    Kindly let me know about the same.

    Thanks and Regards,

    Mitesh

  • Hello Mitesh

    Not putting the device to hibernate mode correctly will not damage the device but may affect the function. Putting Wake pin to GND will cause the device to wakeup after 1-2 32K clocks.