L.R.A 78 Posted July 10, 2014 by the way, it's also possible to get interrupts in the 1/32768 ticks of the crystal but since i haven't realy have tested sometigh solid let's leave that for later But there's the info for anyone that wants to investigate hat Quote Share this post Link to post Share on other sites
spirilis 1,264 Posted July 10, 2014 Looking at the TM4C1294 Connected LaunchPad schematic, there is a populated resistor you might be able to remove in order to source VBAT separately, but you'd be surface-soldering a wire to a tiny resistor pad in order to do so... http://www.ti.com/lit/spmu365 - page 31, see "VBAT" and resistor R38. But it'd be much nicer if there was a PTH pad attached to VBAT so you could easily include a non-boosterpack-standard pin on a custom BoosterPack which provides an alternate VBAT source. (side note- I'm sending feedback to TI asking for this feature in future revisions or models of the Tiva series) 2 sq7bti and L.R.A reacted to this Quote Share this post Link to post Share on other sites
L.R.A 78 Posted July 10, 2014 Yea, maybe next launchpad or even revision they change that Quote Share this post Link to post Share on other sites
L.R.A 78 Posted July 12, 2014 by the way there is sometigh you can implement to "simulate having the vbat". If you use a diode with a 3V batery and you power the launchpad with 3.3V you can actualy always power the launchpad even when the main power goes out. you "waste" a ADC to check the voltage supply, if it's 3V or bellow then you enter sleep mode. The diode is simply to only alow the 3V batery to power the launchpad when the main power supply stops 1 spirilis reacted to this Quote Share this post Link to post Share on other sites
L.R.A 78 Posted July 12, 2014 I tested this before in the tm4c123 to work with the crystal ticks istead of 1 second interrupts. This should generate a interrupt every 0,000030517578125 seconds (1/32768) There's is just 1 problem, if the counter is about to overflow in the next tick, the interrupt will not work properly. inside the interrupt you have to control that. if the SS counter is at 32767 out of 32768 ticks then you have to set the interrupt value of SS to 0. HibernateEnableExpClk(F_CPU); HibernateRTCEnable(); This will set the interrupt to every second: HibernateRTCSSMatchSet(0,HibernateRTCSSGet()+1); HibernateIntRegister(HibernateHandler); HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0); and here is the interrupt function: void HibernateHandler(void) { //Use this to reset interrupt flag uint32_t ui32Status = HibernateIntStatus(1); HibernateIntClear(ui32Status); //Place here code to execute every second, ex: LCD or 7 segment display //Altough it should be as fastest as possible //To keep the interrupt hapening every second you need this HibernateRTCSSMatchSet(0,HibernateRTCSSGet()+1); } Quote Share this post Link to post Share on other sites
SixSixSevenSeven 23 Posted July 12, 2014 To use in tm4c123 you can just do this to turn on the RTC: HibernateEnableExpClk(F_CPU); HibernateRTCEnable(); This will set the interrupt to every second: HibernateRTCMatchSet(0,HibernateRTCGet()+1); HibernateIntRegister(HibernateHandler); HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0); and here is the interrupt function: void HibernateHandler(void) { //Use this to reset interrupt flag uint32_t ui32Status = HibernateIntStatus(1); HibernateIntClear(ui32Status); //Place here code to execute every second, ex: LCD or 7 segment display //Altough it should be as fastest as possible //To keep the interrupt hapening every second you need this HibernateRTCMatchSet(0,HibernateRTCGet()+1); } Tried the sketch here on the stellaris (lm4f120) launchpad: http://pastebin.com/a7p0dnt8 I found the blue and green leds to be too bright to clearly discern the red led so I pwm'ed the blue led to dim it, it is also furthest away from the red, much easier to tell when they are both lit or just one is lit etc. You'd expect the red LED to blink forever and the blue to do the same. That works for a little while, but yet again I am finding that after an entirely random time period the red led stops blinking, yet the blue one carries on functioning so clearly the cpu is still running. The only thing I have found consistent between the time periods in which is takes to pause is that it will always finish with the red led being on, never off. Sometimes it only flashes once before stopping and sometimes it lasts a few minutes. Very strange. Quote Share this post Link to post Share on other sites
SixSixSevenSeven 23 Posted July 12, 2014 Just added a quick counter which is incremented in the hibernate handler and printed in the main loop, so far I have results of 112, 8 and 46 before the interrupt stops firing. Quote Share this post Link to post Share on other sites
SixSixSevenSeven 23 Posted July 12, 2014 http://pastebin.com/DP4LrgBE This also freezes eventually on the tm4c129 Thinking there may be some sort of tivaware or maybe silicon error Quote Share this post Link to post Share on other sites
L.R.A 78 Posted July 12, 2014 in the RTC setup try adding HibernateRTCTrimSet(0x7FFF); Quote Share this post Link to post Share on other sites
SixSixSevenSeven 23 Posted July 12, 2014 in the RTC setup try adding HibernateRTCTrimSet(0x7FFF); I can't leave it running long enough to confirm that this is indeed a long term fix, but I've reached 300 seconds without crash for the first time so at this moment in time its looking like we're up and running Quote Share this post Link to post Share on other sites
L.R.A 78 Posted July 12, 2014 I can't leave it running long enough to confirm that this is indeed a long term fix, but I've reached 300 seconds without crash for the first time so at this moment in time its looking like we're up and running This was probably because the value wasn't set to default wich is 0x7FFF Quote Share this post Link to post Share on other sites
SixSixSevenSeven 23 Posted July 13, 2014 This was probably because the value wasn't set to default wich is 0x7FFF Well the only code thats been on my launchpads has been from energia (without using hibernation) and the factory default so I dont know why it would be non default. But its fixed it, left it since 8am today and its still blinking. Quote Share this post Link to post Share on other sites
L.R.A 78 Posted July 13, 2014 Well the only code thats been on my launchpads has been from energia (without using hibernation) and the factory default so I dont know why it would be non default. But its fixed it, left it since 8am today and its still blinking. It's maybe a factory error. I found a similar problem in a tm4c123 Glad it's solved Quote Share this post Link to post Share on other sites
phaseform 3 Posted September 25, 2015 would someone be able to explain the function of hibernate, in post #21 I don't understand why main is running concurrently to the hibernate timer? Quote Share this post Link to post Share on other sites
phaseform 3 Posted October 21, 2015 is something required in main to go to sleep, HibernateRequest(void)? Quote Share this post Link to post Share on other sites