Hibernate and Watchdog

@ Dat

You’re code works if I use Fez Config to configure LCD as T35. But the big problem is that I am using LCD io’s for other purpose (at the beginning of my application I am performing:

 bool cfg_chg = Configuration.LCD.Set(Configuration.LCD.HeadlessConfig);
            // to use the LCD reserved IOs, return true if config has changed false otherwise.
            if (cfg_chg)
            {
                PowerState.RebootDevice(false); //hard reboot
            }
        }

Therefore how to configure LCD as T35 after that?

EDIT I am just trying to put values shown by FEZConfig and will let U know

Ok here’s the test code:


using System;
using System.Threading;
using Microsoft.SPOT;
//using GHI.Pins;
//using GHI.Processor;
using GHI.Premium.Hardware;
using GHI.Premium.Hardware.LowLevel;
using GHI.Hardware.EMX;
using Microsoft.SPOT.Hardware;

namespace EMX_TestInterruptHibernateUser
{
    public class Program
    {


        static OutputPort LED = new OutputPort((GHI.Hardware.EMX.Pin.IO9), true);
        static InterruptPort bp = new InterruptPort(GHI.Hardware.EMX.Pin.IO18, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
        static InputPort buttontest = new InputPort(GHI.Hardware.EMX.Pin.IO17, false, Port.ResistorMode.PullUp);
        public static void bp_on_interupt(uint port, uint state, DateTime time)
        {
            Debug.Print("Wakup ");

        }
        public static void Main()
        {
            bool cfg_chg = Configuration.LCD.Set(Configuration.LCD.HeadlessConfig);
            // to use the LCD reserved IOs, return true if config has changed false otherwise.
            if (cfg_chg)
            {
                PowerState.RebootDevice(false); //hard reboot
            }
            bp.EnableInterrupt();
            bp.OnInterrupt += new NativeEventHandler(bp_on_interupt);
            GHI.Premium.Hardware.LowLevel.Watchdog.Enable(30000);
            while (true)
            {
                Debug.Print("ALIVE");
                GHI.Premium.Hardware.LowLevel.Watchdog.ResetCounter();
                LED.Write(!LED.Read());
                Thread.Sleep(500);
                if (buttontest.Read() == false)
                {
                    Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations(320, 240, true, true, false, false, true, 41, 27, 51, 10, 8, 16, 9000);
                    Configuration.LCD.Set(lcdConfig);
                    Debug.Print("Sleep mode");
                    Power.Hibernate(Power.WakeUpInterrupt.InterruptInputs);
                }
            }

        }

    }
}


This does not work and I can not figure out why. It seems that setting the LCD crash the system. no interrupt awakes the platform but the watchdog yes! is it a bug or something I am doing wrong! I do not see this bug reported in the documentation.

If hibernation can not be done unless using an LCD then there’s a serious problem!

Having a look on the 4.2 release note, it says that low power mode is not supported… whereas your test code shows we can enter in hibernate mode. Having a look on the GHI Premium library (4.2) we can see that Configuration takes effect after reboot… is it the cause of my problem?

@ leforban -

is it easy to upgrade to 4.3 with your project?

Nop I don’t have VS2012 because my computer is on Vista…

@ andre I know but can’t laugh. I extremely need to fin a solution for that and can’t buy a new computer and migrate the project within a week.