Main Site Documentation

G120 4.3.2 vs 4.3.3 power tests



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?



@ thomas_exmakhina -

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


Hi Dat,

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


@ David@ Emrol -


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()
             SW1.OnInterrupt += new NativeEventHandler(IntButton_OnInterrupt);

             UInt64 wakeupevnt_bk; // new
             while (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


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



or just simple like these:

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


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);


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

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;
               if (d%20==0)
                    time = RealTimeClock.GetDateTime().AddSeconds(20); 
                    PowerState.WakeupEvents |= HardwareEvent.OEMReserved2;
                    PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved2);

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



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


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.


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.

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


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


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


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


Yes, it has been added.



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


@ hagster -

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


@ Dat - You are correct.

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


Yes, only 3 modes:


are supported.


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


@ 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.