Main Site Documentation

G120 4.3.2 vs 4.3.3 power tests


#21

Hi,

Does GHI has a schedule to fix the issue preventing us to go to DeepSleep mode more than once after a reset?

Btw, is there anyone else having trouble to wake up on a RTC event (after a setAlarm) on a G120?

Thanks,


#22

@ thomas_exmakhina -

yes, of course. This bug will be gone in next release.


#23

Hi Dat,

Do you have a date when this next release will be available ?


#24

@ David@ Emrol -

Hello,

try the workaround below while waiting for the fix.


using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.IO;
using GHI.Pins;
using System;
using System.Threading;

 
namespace MFConsoleApplication1
{
    public class Program
    {
         static OutputPort LED1G120HDR = new OutputPort(GHI.Pins.G120.P1_14, true);
         static OutputPort LED1 = new OutputPort(GHI.Pins.G120.P1_17, false);  //46
         static OutputPort LED2 = new OutputPort(GHI.Pins.G120.P1_16, false);  //49
         static OutputPort LED3 = new OutputPort(GHI.Pins.G120.P1_15, false);   //48
         static OutputPort LED4 = new OutputPort(GHI.Pins.G120.P1_9, false);   //47

         static InterruptPort SW1 = new InterruptPort(GHI.Pins.G120.P2_8, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);

         public static void Main()
         {  
             LED4.Write(true);
             Thread.Sleep(4000);
             LED4.Write(false);
             SW1.EnableInterrupt();
             SW1.OnInterrupt += new NativeEventHandler(IntButton_OnInterrupt);

             SW1.EnableInterrupt();  
             UInt64 wakeupevnt_bk; // new
             while (true)
             {

                 LED3.Write(true);
                 Thread.Sleep(4000);
                 LED3.Write(false);

                 LED1G120HDR.Write(true);
                 Debug.Print("Feeling sleepy...");
                 wakeupevnt = (UInt64)PowerState.WakeupEvents;  // new
                 PowerState.WakeupEvents = HardwareEvent.OEMReserved2; // new
                 PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved2); 
                 PowerState.WakeupEvents = (HardwareEvent)wakeupevnt; // new
                 LED1G120HDR.Write(false);
             }

         }

         static void IntButton_OnInterrupt(uint port, uint state, DateTime time)
         {
             Debug.Print("Button Pressed");
         }
        }

    }

#25

or just simple like these:

PowerState.WakeupEvents |= HardwareEvent.OEMReserved2;
PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved2);

#26

Dat’s workaround works for me, after changing into this, since we want to wake up from the input pin:

PowerState.WakeupEvents |= HardwareEvent.OEMReserved1;
PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved1);

#27

Thanks for sharing your result.

And about your second problem, that because you are missing one line important:



here is same code that will auto wake up and deep sleep after every 20 seconds


```cs
void Main()
{
         DateTime now;
         DateTime time;
         now = new DateTime(2014, 7, 15, 13, 46, 0);
         RealTimeClock.SetDateTime(now);   ///=>>>>>>> you are missing this line, 
         //without this line, RTC does not start. Once RTC started, don't need to call again
         int d = 0;
         while(true)
         {
               Thread.sleep(1000);
               d++;
               if (d%20==0)
              {
                    time = RealTimeClock.GetDateTime().AddSeconds(20); 
                    RealTimeClock.SetAlarm(time);
                    PowerState.WakeupEvents |= HardwareEvent.OEMReserved2;
                    PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved2);
              }
         }
}

This code was tested on G120 CorbaII with/without battery 3V. Still work fine.

Dat


#28

Of course, the main power source is still connected :))


#29

I have tested this too and it’s working great. My current measurements from the start of this thread are still valid also. @ DAT you should probably add these figures to the G120 manual now as it still says 60mA for Hibernate.

Was it @ David@ Emrol that came up with this workaround? it’s a bit unclear in from the posts. Big thanks to whomever discovered it anyway.


#30

Does anyone know if it’s possible to wake from DeepSleep using both an interrupt and RTC alarm? E.g I would like the module to wake every hour to do some house keeping or if a user presses a button.

This code will wake with an interruptInput, but the RTC does not work.

    RealTimeClock.SetAlarm(RealTimeClock.GetDateTime().AddSeconds(5));
                PowerState.WakeupEvents |= HardwareEvent.OEMReserved2 | HardwareEvent.OEMReserved1;
                PowerState.Sleep((SleepLevel.DeepSleep,HardwareEvent.OEMReserved2 | HardwareEvent.OEMReserved1);

#31

It won’t work if using both in the current firmware
But we will try to make you happy if we have time.


#32

That’s a definite need - cyclic and user wakeups. Please make us all happy :slight_smile:


#33

Yes option for both (RTC and interrupt input) wake up at same time will be very usefull thing…


#34

Yes, it has been added.


#35

FYI.

I have remeasured the power consumption on the G120 at various clock speeds.

Clock Speed…48MHz…60MHz…84MHz…96MHz…120MHz
Idle…64 mA…73 mA…90 mA…99 mA…115 mA
Work…87 mA…100 mA…123 mA…134 mA…158 mA
Deep Sleep…18 mA…18 mA…18 mA…18 mA…18 mA

I’m still on a mission to kill that 18mA


#36

@ hagster -

There is “Power-down mode” that you can try.
Or using shut off option but this option look like reset after wake up.


#37

@ Dat - You are correct.

SleepLevel.Off = 4.4mA - RTC wake only. Also wake is like a hard reset.
SleepLevel.SelectiveOff doesn’t work


#38

Yes, only 3 modes:

SleepLevel.sleep
SleepLevel.Deepsleep
SleepLevel.Off

are supported.


#39

Just to clarify… are you using G120HDR or a board like cobra?
With a cobra board my sleep.off = 24mA


#40

@ geologic - g120HDR

How are you measuring? I have a gadgeteer cable with a bypass to a DVM between the DP power module and the G120HDR. I assume that the DP module is a bit inefficient.