Main Site Documentation

G120 RTC and Power Modes Recommendations


We are revising our G120 based board, and looking at the forums and documentation a lot has happened, and I just want some clarifications regarding the RTC implementation, and how it relates to the power modes.

Our goal is simple, allow the board to go in low power mode (Off), and setup an RTC alarm/interrupt to wake the board every 6 hours for example, that is scenario 1.
While the board is in low power/off mode, a user may press a button and cause interrupt to wake up the board, so we need to cover that case too, scenario 2.

A complete restart of the app is ok, no need to access or have any peripherals work during power off.

Looking at the G120 docs, for the RTC seems like we need only a crystal, and a battery. Is there anything else recommended like a dedicated port or something that we should do to cover the scenarios above?

Any other recommendations? Thanks.


I think the micro used on G120 supports deep sleep but you can only wake up from a specific pin or reset. The micro datasheet may give you some hints LPC1788.

There is a mode where the system is partially sleep where to can wake up from a pin as will. So it depends on how low you want to go.


Thanks Gus, that will work, we will dedicate one pin that supports the interrupt for the wake up, so sounds like if we do that with dedicated pin, we can have it wakeup from deep sleep.

Will see what the specs for the LCP17x say as well.


Ok, so I did some testing on the current board, and need to clarify wake up options. Can the wake up option from RTC and Interrupt be enabled at the same time?

I did this test with DeepSleep code and it works perfectly with the interrupt from the button.

var key4 = new InterruptPort(Cpu.Pin.GPIO_PinP2_13, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
key4.OnInterrupt += interrupt_OnInterrupt;

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

Your examples show for RTC we need to use HardwareEvent.OEMReserved2, and for GPIO HardwareEvent.OEMReserved1.

How would I make it for both to be enabled, either an alarm from the RTC or GPIO interrupt to wake the board?


HardwareEvent is a flags enum, so you can or them together like HardwareEvent.OEMReserved1 | HardwareEvent.OEMReserved2


Thanks John, that will do it for us, perfect!