Main Site Documentation

No awakening after hibernation with Rhino


#1

if I run the hibernation test from the Low Power Wiki (http://wiki.tinyclr.com/index.php?title=Low_Power) Rhino never awakes.
Why?


#2

which test? there are several examples.


#3

If you are using alarm to wake up then first read the real time clock and make sure it is running.


#4

Now I see:
The statement
Debug.Print(“Good Morning”);
makes no sense, because the connection via USB is lost, if device is in hibernation: So the Rhino awakes, but has no mouth to say “Good Morning”…


#5

You can see the messages by using MFDeploy tool


#6

Good idea! But how to?


#7

Open MFDeploy and click connect :slight_smile: That simple


#8

Thanks GUS
perhaps you make a hint in the beginners guide:

using System;
using System.Threading;
using Microsoft.SPOT;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.Hardware.LowLevel;
 
using GHIElectronics.NETMF.FEZ;
public class Program
{
    public static void Main()
    {
        //blink LED
        FEZ_Components.LED led = new FEZ_Components.LED(FEZ_Pin.Digital.LED);
        led.StartBlinking(100, 100);
        //set to any random but valid time
        RealTimeClock.SetTime( new DateTime(2010, 1, 1, 1, 1, 1));
        while (true)
        {
            Thread.Sleep(4000);//blink LED for 3 seconds
            Debug.Print("Going to sleep for 5 seconds!");
            RealTimeClock.SetAlarm(RealTimeClock.GetTime().AddSeconds(5));
            //Debug.Print("Time: " + RealTimeClock.GetTime());
            // sleep for 10 seconds
            Power.Hibernate(Power.WakeUpInterrupt.RTCAlarm);
            Thread.Sleep(4000);
            //this you see only in the MFDeply.exe after hitting F5
            Debug.Print("Good Morning!");
        }
    }
}

#9

The guide needs major updates :slight_smile: It has been a while and many things have changed. I am waiting till NEMTF4.2 is out before updating it.

For now, you can help by updating the wiki if you like http://wiki.tinyclr.com/index.php?title=Low_Power


#10

[quote]For now, you can help by updating the wiki[/quote]I did.


#11

Ok. let’s go to the next (the 3rd) example: [italic]awake by LDR-Button via Input glitch.[/italic]
If I hit the LDR-button nothing happens.

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

using GHIElectronics.NETMF.FEZ;
public class Program
{
    public static void Main()
    {
        //blink LED
        FEZ_Components.LED led = new FEZ_Components.LED(FEZ_Pin.Digital.LED);
        led.StartBlinking(100, 100);
        //setup the interrupt pin with glitch filter enableled
        InterruptPort LDR = new InterruptPort((Cpu.Pin)0, true,
                                    Port.ResistorMode.PullUp,
                                    Port.InterruptMode.InterruptEdgeLow);
        while (true)
        {
            Debug.Print("blink blink");
            Thread.Sleep(3000);//blink LED for 3 seconds
            // sleep
            Power.Hibernate(Power.WakeUpInterrupt.InterruptInputs);
            //we get here when we wakeup           
        }
    }
}

#12

The example has pin0 for some reason! You need to update it with the correct pin you are using


#13

Ok let’s take the interrupt-example: (just to be shure, that LDR is PIN0)
if I hit the LDR-Button in the first 3 seconds, I get the result: [italic]LDR-Button pressed![/italic]
After Hibernation nothing happens.

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

using GHIElectronics.NETMF.FEZ;
public class Program
{
    public static void Main()
    {
        //blink LED
        FEZ_Components.LED led = new FEZ_Components.LED(FEZ_Pin.Digital.LED);
        led.StartBlinking(100, 100);
        //setup the interrupt pin
        InterruptPort LDR = new InterruptPort((Cpu.Pin)0, false,
                                   Port.ResistorMode.PullUp,
                                   Port.InterruptMode.InterruptEdgeLow);
        LDR.OnInterrupt += new NativeEventHandler(LDR_OnInterrupt);

        while (true)
        {
            Thread.Sleep(3000);//blink LED for 3 seconds
            // sleep
            Power.Hibernate(Power.WakeUpInterrupt.InterruptInputs);
            //we get here when we wakeup
        }
    }

    static void LDR_OnInterrupt(uint data1, uint data2, DateTime time)
    {
        Debug.Print("LDR-Button pressed!");
    }
}

#14

So it is working in the first example but now you have a problem with the second one?
Try to deploy the program without debugging (CTRL+F5).
Look at the LED it should blink when you press the button.
Seeing messages over USB or while debugging will be a bit hard and can cause problems because the USB is getting connected and disconnected…


#15

[quote]Look at the LED it should blink when you press the button.[/quote]only if it is not in hibernate. afterwards it stops blinking and then the btn has no effect.


#16

We tried it on a Rhino with firmware V 4.1.6.0 and it works…
It does NOT work if you are connected to visual studio debugging because the USB connection resets. Deploy the program, disconnect from VS and then reset the board. Does it work when it reboots as expected?


#17

I guess the wiki must be updated. No low power with USB connected


#18

I’m affraid it [italic]never [/italic]works (at least on my Rhino-bord and MF 4.1.6.0)
[ol]if I power Rhino up via USB with MODE=1 LDR-Btn has no effect (=no blinking)

If I set the MODE=0 (Debug to COM) the LDR-Btn has still no effect.
if I power Rhino with external supply: 270 mA, but in hibernation 306 mA and no LDR-effect
If I do the same with MODE=0: same case no effect, current increase.[/ol]
btw your [List] functions in this forum have only blank indications (no numbers, no signs)


#19

Note: Glitch filter is required for hibernation wake-up. In the interrupt example you are using it is disabled. Or am I mistake? Won’t be the first time… :slight_smile:


#20

I think you are right, but as far as I understand it is necessary, that there is an interrupthandler (from glitch or a self written one). So here is my testcode (with such handler). Perhaps I misunderstood something (would also not be the first time :frowning: )

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

using GHIElectronics.NETMF.FEZ;
public class Program
{
    public static void Main()
    {
        //blink LED
        FEZ_Components.LED led = new FEZ_Components.LED(FEZ_Pin.Digital.LED);
        led.StartBlinking(100, 100);
        //setup the interrupt pin
        InterruptPort LDR = new InterruptPort((Cpu.Pin)0, false,
                                   Port.ResistorMode.PullUp,
                                   Port.InterruptMode.InterruptEdgeLow);
        LDR.OnInterrupt += new NativeEventHandler(LDR_OnInterrupt);
        Debug.Print("Blink Blink");
        while (true)
        {
            Thread.Sleep(3000);//blink LED for 3 seconds
            // sleep
            Power.Hibernate(Power.WakeUpInterrupt.InterruptInputs);
            //we get here when we wakeup
        }
    }

    static void LDR_OnInterrupt(uint data1, uint data2, DateTime time)
    {
        Debug.Print("LDR-Button pressed!");
    }
}