Using the Tiny RTC to wake from a deep sleep


The DS1307 on the Tiny RTC can generate a square wave every second.  This can be used as a periodic interrupt to wake the LPC1114 from a deep sleep.  GPIO0 pins 0 to 11 and GPIO 1 bit 0 can trigger a wake event; in this case, GPIO0 bit 8 (GPIO0_8) was used.  This involves a little bit of interrupt configuration and some confusion as GPIO0_8 can be used as a general purpose external interrupt as well as a wake-up interrupt.  These are not programmed in the same way.  Anyway, during deep sleep, current consumption drops to 67 micro amps, and runs up to about 12mA during full speed operation.  No doubt more tweaking code be done to reduce these figures further.  Code is available over here on github

The code contains a function called lp_ports which configures all unused GPIO’s as outputs and turns off pull up resistors.  I didn’t find this made much difference so the function remains but is not called.