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.

TM4C1231E6PM can not always be waken up from deep sleep mode

Other Parts Discussed in Thread: TM4C1231E6PM

Hi all ,

I found that my TM4C1231E6PM processor can't always be waken up form deep-sleep mode.

First , I had configure the following configuration in the header of main function :

SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |SYSCTL_OSC_MAIN);

	//Enable peripherals 
	SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);

	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_HIBERNATE);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_HIBERNATE);	
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_CAN0);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_CAN0);	
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOC);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOC);
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOF);
	SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_WDOG0);
	SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_WDOG0);

	SysCtlPeripheralClockGating(true);


Second , I register a interrupt handler in GPIO_PORTC_BASE - GPIO_PIN_4 :

GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_4);
GPIOPinIntClear(GPIO_PORTC_BASE , GPIO_PIN_4);
GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_FALLING_EDGE);
IntPrioritySet(INT_GPIOC, 6<<5);
GPIOPortIntRegister(GPIO_PORTC_BASE, GPIO_C_INT_HANDLER);
GPIOPinIntEnable(GPIO_PORTC_BASE, GPIO_PIN_4);

Third , periodically enter deep-sleep by calling the following function :

SysCtlDeepSleepClockSet(SYSCTL_DSLP_DIV_4|SYSCTL_DSLP_OSC_INT30);
SysCtlDeepSleep();

I found my TM4C1231E6PM processor can't always be waken up by GPIO_PORTC_BASE - GPIO_PIN_4. I put a pulse per 10 seconds to GPIO_PORTC_BASE - GPIO_PIN_4 , and the processor can be waken up for most of times (>99 %) when it in deep-sleep mode. But once the processor miss a interrupt , it will always hang in deep-sleep mode.

Would anyone knows the condition that TM4C1231E6PM will hang in deep-sleep mode and can't be waken up by interrupt ?

Thanks.

Cory

  • Hello Cory

    When running in deep sleep with the configuration as listed above, the deep sleep system clock source is 30KHz/4 = 7.5KHz or 133us clock period. For the GPIO Pulse to be recognized as a falling edge the pulse should be high for at least 3 deep sleep system clock before it is made low.

    Regards

    Amit

  • Hi Amit,

    The pulse signal on the GPIO pin will keep low for 15 ms then drive to high , so I think the time is enough to wake up the processor from deep-sleep mode.

  • Hello Cory

    How long is the GPIO *** High before going low after the device enters deep sleep?

    Secondly have you enabled the interrupt in NVIC?

    IntEnabled(INT_GPIOC);

    IntMasterEnabled();

    Regards

    Amit

  • Hi Amit,

    1. The GPIO will be driven to low for 15 ms then be driven to high for 10 seconds.

    2. IntEnable() is called at GPIOPortIntRegister().

    3. I did not call IntMasterEnable() in my firmware , is there any relation about this function ?

    Thanks.

     

  • Hello Cory,

    1. So the GPIO is toggling fine. Just for confirmation. When going into deep sleep the GPIO is high, during deep sleep the GPIO is driven low for 15ms and then driven high.

    2. The IntMasterEnable is required for the NVIC to be able to forward the Interrupt request to the CPU.

    To double check the theory, do not go into deep sleep and run the gpio toggle. It should go to the Interrupt Handler. If it does not then there is the issue.

    EDIT: I am sorry for having being confused by the original thread. The CPU wakes up 99% of the time. If the CPU does not see an interrupt when in deep sleep it will not wake up or if the interrupt occurs before the deep sleep and CPU processes it then it will not wake up either.

    The only method to wakeup the CPU is by using a Watch dog timer which can reset the device and mist be reloaded before deep sleep entry, so that if the interrupt is missed then it will recover the device

    Regards

    Amit