Tool/software: Code Composer Studio
Hello,
I am facing problem to understand the hibernation module HibernateGPIORetentionEnable() API.
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.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_3, 0x08);
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
HibernateEnableExpClk(SysCtlClockGet());
HibernateGPIORetentionEnable();
SysCtlDelay(64000000);
HibernateRTCSet(0);
HibernateRTCEnable();
HibernateRTCMatchSet(0,5);
HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC);
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3, 0x00);
HibernateRequest();
while(1)
{
}
}
As per the code given my controller Green LED will be ON first time for 5 Seconds and it will become of because of the line which is written before to HibernateRequest() line. Then once the board goes to hibernate mode it cut the power and retain the GPIO status as per HibernateGPIORetentionEnable() API. After 5 seconds it is coming back to active mode and the GREEN LED is turning ON again. My doubt is why the GREEN LED is turning ON again after coming back from Hibernate mode.
As per the code before going back to hibernation mode GREEN LED will be OFF so as per the code after coming back from hibernation mode GREEN LED should be OFF only but here GREEN LED is turning ON.Why it is happening like that????
Thank You.
#include <stdint.h>#include <stdbool.h>#include "inc/hw_memmap.h"#include "driverlib/sysctl.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_3, 0x08);SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);HibernateEnableExpClk(SysCtlClockGet());HibernateGPIORetentionEnable();SysCtlDelay(64000000);HibernateRTCSet(0);HibernateRTCEnable();HibernateRTCMatchSet(0,5);HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC);GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3, 0x00);HibernateRequest();while(1){}}