Home arrow Support arrow Forums

Luminary Micro Forums

<< Start < Prev 1 2 3 4 5 Next > End >>

ckuecker

Platinum Boarder
Click here to see the profile of this user

2008/06/27 09:00

Re:LM3S6965 crashes in hibernate

Ok - here's where we are:

Hibernate setup runs OK. The oscillator is working OK. Underneath all of that, BLinky is still blinking.

Now, I want to put the unit into hibenate mode and wake after one second, so this is the code I have running:

Code:

  // Hibernate interrupt handler void dummy_int_handler(void) {     for(ulLoop 0ulLoop 2ulLoop++); // just somewhere to hang an breakpoint! } //***************************************************************************** // // Blink the on-board LED. // //***************************************************************************** int main(void) {     volatile unsigned long ulLoop;     volatile unsigned long ulLoop1;     //     // Enable the GPIO port that is used for the on-board LED.     //     SYSCTL_RCGC2_R SYSCTL_RCGC2_GPIOF;     //     // Do a dummy read to insert a few cycles after enabling the peripheral.     //     ulLoop SYSCTL_RCGC2_R;     //     // Enable the GPIO pin for the LED (PF0).  Set the direction as output, and     // enable the GPIO pin for digital function.     //     GPIO_PORTF_DIR_R 0x01;     GPIO_PORTF_DEN_R 0x01;     SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);          if(HibernateIsActive())    // If waked from hibernate, don't do cold boot init!     {                 HibernateDataGet(NV_clock_ram.NV_imagesizeof NV_clock_ram.NV_image);    // Recover critical RAM stuff     }          else     {         HibernateEnableExpClk(SysCtlClockGet());         for(ulLoop 0ulLoop 200000ulLoop++)    // Wait a second...         {             for(ulLoop1 0ulLoop1 25ulLoop1++)             {             }         }              HibernateEnableExpClk(SysCtlClockGet());         HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128); // Set up hibernation module for 32 kHz input         HibernateWakeSet(HIBERNATE_WAKE_RTC);         HibernateRTCMatch0Set(512);         HibernateRTCEnable();         HibernateIntRegister(dummy_int_handler);         HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);     }          //     // Loop forever.     //     while(1)     {         //         // Turn on the LED.         //         GPIO_PORTF_DATA_R |= 0x01;         //         // Delay for a bit.         //         for(ulLoop 0ulLoop 200000ulLoop++)         {         }         //         // Turn off the LED.         //         GPIO_PORTF_DATA_R &= ~(0x01);         //         // Delay for a bit.         //         for(ulLoop 0ulLoop 200000ulLoop++)         {         }                          HibernateDataSet(NV_clock_ram.NV_imagesizeof NV_clock_ram.NV_image); // Save critical RAM stuff         HibernateRequest();        // Go to sleep (hibernate)     } }



NV_clock_ram.NV_image is a union of variables I will need later on, to restore the processor state when it wakes back up.

The main loop never quits - after the HibernateRequest() call, it just goes back to the top of the while(1). I put a breakpoint above the main loop, and at the hibernate IRQ handler - neither one is reached once the program gets rolling. The crystal keeps on running even with the code stiopped - I guess that's a good thing.

Is there an app note or example that runs hibernate and wakes on a periodic match?

login or register to reply

cb1

Platinum Boarder
Click here to see the profile of this user

2008/06/27 09:42

Re:LM3S6965 crashes in hibernate

Hurray for us - persistence is rewarded. Thanks for posting your results so that a "trail" is left for other forum users...

Do tell - did you make any changes to hibernate.h as I suggested - or did you get the xtal to "fire" just with the addition of the 1M resistor? My belief is that HIBCTL must contain 0x40 to enable the 4.19MHz xtal.
Please confirm.

Seeing clients this a.m. - will review your code & get back to you in p.m.

login or register to reply

ckuecker

Platinum Boarder
Click here to see the profile of this user

2008/06/27 09:53

Re:LM3S6965 crashes in hibernate

I tried both the original values and your suggested changes in the present code - I see no difference. The oscillator is still going, and so is Blinky.

What bothers me is that I never, ever hit my initialization code, even after reloading the program with the debugger, or causing a hard reset - or even a power cycle. I originally had the initialization directly in-line in the main function, but added the check for hibernate mode active to attempt to recover after waking, without running through a one-second delay during the setup. That would kill us.

Either something on the demo board has a really long holdup time or the hibernate settings are non-volatile - or we've still got a problem hiding in there.

login or register to reply

cb1

Platinum Boarder
Click here to see the profile of this user

2008/06/27 10:04

Re:LM3S6965 crashes in hibernate

Forgive me - by initialization code do you mean your if (hibernateIsActive)?

login or register to reply

cb1

Platinum Boarder
Click here to see the profile of this user

2008/06/27 10:15

Re:LM3S6965 crashes in hibernate

May I suggest this:

I believe that hibernate module can/will generate interrupts "even when NOT" in hibernate. This is valuable to users as they can employ hibernate as a programmable RTC, or delay generator, without "tieing up" the micro or using one of the complex timers.

So - suggest that we attempt to verify that hibernate's RTC is working - and that we can generate & exploit hibernate interrupt.

If you agree I'll provide brief code for you to test/verify. Let me know...

login or register to reply

cb1

Platinum Boarder
Click here to see the profile of this user

2008/06/27 10:34

Re:LM3S6965 crashes in hibernate

Looked quickly at your latest listing.

It is my belief that you need BOTH of these lines - back to back - to enable the hibernate module: (you have just the 1st!)

SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
HibernateEnableExpClk(SysCtlClockGet());

Suggest that you KISS - don't try HibernateRequest() until you can generate hibernate interrupts reliably. Again my belief is that these may be generated simply by enabling your hibernate module. (with the back to back instructions I've provided)

Lastly - it takes time to "enter & exit" hibernate. Using a 1 second value dooms you to failure - methinks. Use at least 20 or 30 seconds - to start.

login or register to reply
<< Start < Prev 1 2 3 4 5 Next > End >>