Main Site Documentation

After Power.Hibernate cant wake up (here is code and what is this wrong?) fez_panda


#1
   #region Class variables

        private static M1PowerSleep mInstance;
        private bool isSleeping = false;
        #endregion

        #region Properties

        public static M1PowerSleep Instance
        {
            get { return mInstance; }
        }


        #endregion

        #region Methods
        public void InitPowerSleep()
        {
            mInstance = new M1PowerSleep();
            while (true)
            {
                if (!IOInterface.Instance.BooleanInputStatus)
                {
                    if (!isSleeping)
                    {
                        DeviceSleep();
                    }
                }
            }
        }

        public void DeviceSleep()
        {
            isSleeping = true;
            Thread.Sleep(30000);
            Debug.Print("Shutting Down GSM Modem");
            GprsModem.Instance.MakePulls();
            Thread.Sleep(5000);
            RealTimeClock.SetAlarm(RealTimeClock.GetTime().AddMinutes(1));
            Debug.Print("Going to sleep M1");
            Power.Hibernate(Power.WakeUpInterrupt.InterruptInputs | Power.WakeUpInterrupt.RTCAlarm);
            DeviceWakUp();
        }

        public void DeviceWakUp()
        {
            isSleeping = false;
            Debug.Print("Wake up M1");
            GprsModem.Instance.MakePulls();
            Thread.Sleep(5000);
            GprsModem.Instance.SendData();
        }

#2

From our super support page http://www.tinyclr.com/support
take a look at this please http://wiki.tinyclr.com/index.php?title=Low_Power


#3

tnx but when in interrupt port coming impulse device wakes up very well, but on timer not wakes up
i dont understand why? :frowning:


#4

[quote] but on timer not wakes up
i dont understand why? [/quote]

There is code on that page to makeup on alarm. Have you tried it?


#5

i created new project and here is Code
and can someone tell me what is a wrong?

i took code from here:
http://wiki.tinyclr.com/index.php?title=Low_Power

using System;
using System.Threading;
using Microsoft.SPOT;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.Hardware.LowLevel;

using GHIElectronics.NETMF.FEZ;
using Microsoft.SPOT.Hardware;

namespace Hibernate
{

    public class Program
    {
        private static OutputPort LED;
        public static void Main()
        {
            //blink LED
            LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
            StartBlinking(500, 500);

            RealTimeClock.SetTime(new DateTime(2010, 1, 1, 1, 1, 1));
            while (true)
            {
                Thread.Sleep(3000);//blink LED for 3 seconds
                RealTimeClock.SetAlarm(RealTimeClock.GetTime().AddSeconds(10));
                Debug.Print("Going to sleep for 10 seonds!");
                // sleep for 10 seconds
                Power.Hibernate(Power.WakeUpInterrupt.RTCAlarm);
                Debug.Print("Good Morning!");
                StartBlinking(100, 100);
            }
        }

        private static void StartBlinking(int OnState, int OffState) {
            LED.Write(true);
            Thread.Sleep(OnState);
            LED.Write(false);
            Thread.Sleep(OffState);
            LED.Write(true);
            Thread.Sleep(OnState);
            LED.Write(false);
            Thread.Sleep(OffState);
            LED.Write(true);
            Thread.Sleep(OnState);
            LED.Write(false);

        }
    }
}


#6

i tested this code On Domino and worked, why not working on Panda and how to solve this problem? please someone help me : ))) :(((


#7

No RTC on Panda.


#8

RTC available on panda II only :wink:


#9

tnx all but its very bad news :D:D :)))
:((((((
and there is not something way to wake up using timer? :frowning:


#10

Not without additional circuitry on Panda


#11

Do you need a fixed time value? If yes, for what timespan?

If it’s only for a fixed couple of seconds, you can connect a capacitor to an interrupt pin. When the device is awake you put 3V3 on the cap with an output pin. When the device hibernates, the capacitor discharges until it reaches the TTL low level on the interrupt pin to wake up the device.


#12

i solved the problem so i added quartz on board and worked :slight_smile: