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.

TM4C Won't Stay in Hibernation

Other Parts Discussed in Thread: EK-TM4C1294XL, TM4C1294NCPDT

Hello,

I'm trying to setup the Hibernation module on a TM4C1294CPNDT in calendar mode.  The module seems to be working in that I can set and read the time and even program the match registers.  When I issue a request for hibernation, the TM4C does seem to hibernate, but almost immediately comes back to life.  It's acting like I simply pressed a "reset" button. 

I'm setting the hibernation period for 3 minutes and comparing the match registers with the calendar registers shows a 3 minute difference.  The only wake feature seemingly enabled is the RTCWEN. 

Any thoughts on why the TM4C won't stay in hibernation?

Thanks,
Eric

  • Hello Eric

    Is this a custom board or a LaunchPad/EVM that you are using?
  • Hi Amit,

    This is a custom board.

    Thanks,

    Eric

  • Hello Eric

    Is the Custom board designed for VDD3OFF mode or VDD3ON mode and has the Hibernate module HIBCTL register been configured as per the board design. If the board is designed for VDD3OFF mode and the setting is VDD3ON mode then it could be the cause of the immediate wakeup.

    Can you please share the Schematic for the TM4C129x device and double check the software setting of the Hibernate module just before HibernateRequest is asserted.
  • Hi Amit,


    I don't think I considered the circuit properly for the hibernation module.  Please see the original schematic for the power section attached.  I just modified the circuitry because I really want the device to operate with VDD3OFF.  The current circuit now uses the HIB signal to control a transistor switch supplying power to VDD.  I have only one supply for both VBAT and VDD,  While VBAT is always on, VDD is now switched (it wasn't originally). 

    The result is the same as before.  The device seems to enter hibernation and immediately comes back out.  The HIB signal is asserted for only about 20us before returning high.  This isn't enough time for my transistor circuit to fully disengage due to capacitance.

    I did check the control register and the the VDD3ON bit is cleared before requesting the hibernation.schematic.tiff

    Any thoughts on what might be happening?

    Thanks,

    Eric

  • Hello Eric

    So the configuration of the device is for VDD3ON i.e. the 3.3V supply will not be shutdown. Now can you take a snapshot of the Hibernate configuration before the HibernateRequest is function is executed.

    You would need the VDD3ON bit set in the control register HIBCTL.
  • Hi Amit,


    It was for VDD3ON until I modified the circuit board this morning.  I haven't updated the schematic yet, which still shows the original configuration.  I now am using the HIB signal to switch VDD off.  This is the configuration with which I'd like to proceed.  Attached is the screen shot of the control register associated with the current configuration for VDD3OFF.  I'm still only seeing the HIB signal asserted for about 20 us.  Because this pulse is so short, VDD is never actually cutoff.  Is it normal for HIB to assert for only 20us and then reset if the power conditions don't match the configuration ( in this case, is it normal for the Hibernate module to automatically come out of hibernation if VDD isn't removed within 20 us?)  If so, I'll need to modify the circuit to ensure VDD is removed within this time period.

    Thanks,
    Eric

  • Hello Eric,

    If you modified the circuit for VDD3OFF mode, then what is VBAT pin connected to? I would like to see the correct schematic.
  • New Schematic.tiffHi Amit,

    Please find an updated schematic attached.  VBAT is connected to the continuous 3.3V.  The VDD connections are tied to the switched 3.3V.

    Thanks,

    Eric

  • Hello Eric

    Wake pin must not be connected to the 3.3V Switched rail. WAKE pin is in the VBAT voltage domain.
  • Hi Amit,

    I can make that change. Just so I understand, is the wake signal preventing proper operation? This circuit is there for future use and I don't have the PINWEN bit set in the control register. With the current operation, the 3.3SWITCHED is never switched off. When HIB is asserted, the gate of the p-channel 6402 rises but does not reached the threshold level before the HIB signal is deasserted.

    Thanks,
    Eric
  • Hello Eric,

    Before making the change, can you please show me a scope snapshot of HIB and 3.3VSWITCHED supply when HIB is asserted low?
  • Hi Amit,

    Please see attached.  Dark blue is the HIB and light blue is 3.3VSWITCHED.

    By the way, I did reconnect WAKE to VBAT instead of 3.3VSWITCHED and didn't see any improvement.

    Thanks,

    Eric

  • Hello Eric,

    I used the hibernate example on an EK-TM4C1294XL and used only RTCEN so that the VDD3ON mode bit is 0 with the board configured for VDD3ON. The device does not hibernate.
  • Hi Amit,

    I'm not sure I understand.  Are you saying this device does not hibernate?

    Thanks,

    Eric

  • Hello Eric

    If the device is configured for VDD3OFF mode and the VDD supply does not ramp down, the device is not in Hibernate mode and the CPU can continue with its code execution.
  • Hello Eric

    I ran the test case on my side and I got the following image. It is different from what you have. The HIBn signal remains low.

    I am not sure why it is the case that for your board HIBn comes back up

    1. Can you check the RTC Match value and RTC count when going to Hibernate mode?

    2. Can you check the interrupt status register to see which bits have been set?

  • Hi Amit,


    I'm using the hibernate module in calendar mode.  Here are the values for the calendar registers and match registers for the seconds, minutes, hours and day of the month before requesting hibernation:

    Field                            Calendar                                Match

    Sec                              111011                                    111000

    Min                               011101                                    100010

    Hr                                 111                                            111

    DOM                            1010                                         1010


    These values look okay to me as I requested a hibernation for 5 minutes.

    After coming right back out of hibernation, the only bits set in the interrupt status register are the WC and RTCALT0. 

    I'm surprised to see the RTC match flag is set because the all the time fields don't match.  Maybe I don't understand how this mode works.  It was my understanding that, when using calendar mode, all fields in the match register must match the corresponding calendar fields.  It would explain the immediate coming out of hibernation if only one field must match.  But, if this is true, how do you set up the module to come out of hibernation at a specific date/time?


    Thanks for your continued support!

    Eric

  • Hello Eric

    One thing to note about Hibernate module, is that once it is enabled for a wake-up source, the registers cannot be reset without first erasing the flash and power cycling of the device. It may be possible that a previous match may be holding the wake-up source.

    Also are you clearing the match in the software? I will see if I can get a 5 second Calendar Match code for VDD3ON working (I don't have a ready to use code) and send it over to you so that you can baseline your board.
  • Thanks Amit.

    I'm not clearing the match in software. The datasheet mentions the interrupts are cleared with a hibernation request so I didn't think I needed to clear them manually. Do I?

    Let me describe my end goal. For my system, I need the ability to enter a low-power mode and wake up automatically at some future time (could be minutes up to hours). The shut-down/wake-up process will be periodic. My preference is to shut down power to the entire circuit, except for the VBAT connection to the hibernation module. Since my system also requires a calendar-based RTC, my plan was to use the hibernation module as both the master time keeper and as the controller for low-power shutdown. Is it appropriate to use the hibernation for both these functions?

    I appreciate you looking into the code further. My current circuit configuration is for a VDD3OFF configuration instead of the VDD3ON.

    Thanks,
    Eric
  • Hello Eric

    OK. Let me try something very simple for VDD3OFF mode.
  • Hello Eric

    Attached is a simple RTC wake only with VDD3OFF. I have tested it and it is working for me. The code attached can be used on your device to test if VDD3OFF is working as expected or not. The manner in which the code is written, is such that it goes into hibernate for 10 seconds and on wakeup it will be stuck in a while(1) loop of the default interrupt handler. Attached is the scope snapshot as well where the VDD supply ramps down. Clearly there is no 20 us time where the HIB comes back up.

    #include <stdbool.h>
    #include <stdint.h>
    #include "inc/hw_hibernate.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/hibernate.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    
    void HibernateIntHandler(void)
    {
    	uint32_t ui32IntStatus;
    
    	ui32IntStatus = HibernateIntStatus(true);
    
    	HibernateIntClear(ui32IntStatus);
    }
    
    
    int main(void)
    {
    	uint32_t ui32HibCtl;
    	
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
    
    	ui32HibCtl = HWREG(HIB_CTL) & HIB_CTL_CLK32EN;
    
    	if(ui32HibCtl != HIB_CTL_CLK32EN)
    	{
    		HibernateEnableExpClk(16000000);
    		HibernateWakeSet(HIBERNATE_WAKE_RTC);
    
    		//
    		// 5 Second match
    		//
    		HibernateRTCSet(0);
    		HibernateRTCMatchSet(0,10);
    
    		HibernateRTCEnable();
    	}
    	else
    	{
    		HibernateRTCDisable();
    
    		//
    		// 5 Second match
    		//
    		HibernateRTCSet(0);
    		HibernateRTCMatchSet(0,10);
    
    		HibernateRTCEnable();
    
    	}
    
    
    	HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);
    	IntEnable(INT_HIBERNATE);
    
    
    	HibernateRequest();
    	while(1);
    }
    

  • Hi Amit,

    I was just in the middle of preparing a reply when yours came in. Thank you very much for this file! I was just able to get my system to shut down. Based on your earlier comments, I decided to clear any pending interrupts before requesting the hibernate. This seems to have worked! At the top of page 564 in the datasheet for the TM4C1294NCPDT it mentions that interrupts are cleared by entering hibernation. I don't think this is true and may be an error in the datasheet.

    I'm going to play with this some more and try different timings, but I think we can mark this issue as resolved.

    Thanks again!
    Eric