Other Parts Discussed in Thread: MIKROELEKTRONIKA
Hi guys,
I'm having some troubles with waking from hibernation. I'm using EasyMx Pro V7 Stellaris board from MikroElektronika and CCSv6. I was following TM4C123G LaunchPad Workshop examples, to be precise Lab6 exercise, and everything was fine, but then I tried to do something a little different. I wanted to exit hibernation on a button press, where button is connected to Pin 0 of Port F. Here is my code so far.
#include <stdint.h>
#include <stdbool.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_8MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x08);
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
// This function enables the Hibernation module for operation. This function
// should be called before any of the Hibernation module features are used.
HibernateEnableExpClk(SysCtlClockGet());
HibernateGPIORetentionDisable();
HibernateIntClear(HIBERNATE_INT_PIN_WAKE);
SysCtlDelay((SysCtlClockGet()/3)*4); // Delay for 4 seconds
// Configure the RTC wake-up parameters; reset the RTC to 0, turn the RTC
// on and set the wake up time for 5 seconds in the future
HibernateRTCSet(0);
HibernateRTCEnable();
HibernateRTCMatchSet(0,6);
HibernateWakeSet(HIBERNATE_WAKE_GPIO | HIBERNATE_WAKE_RTC); // Wake on MCU is not connected
GPIOPinTypeWakeHigh(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0x00);
HibernateGPIORetentionEnable();
HibernateRequest();
while(1)
{
}
}
The idea was to leave hibernation on PF0 pin high state. Tried everything but just can't get it right. What am I missing guys?