I picked up a watch kit off eBay that has an
STC15L204EA MCU and a DS1302 RTC and a 4 digit LED display. It's all powered by a CR2032. The firmware that comes with it just displays the time in 24 hour format. I wanted to write some new firmware for it to display 12 hour format. I found
this firmware someone else had created for another STC15-based clock and forked it as a base for
my new firmware.
Long story short, I've got it displaying the time in 12 hour format and added a few more features. Now I'm focusing on power consumption because it's powered by a CR2032 and the case is annoying to take apart to change batteries, so I'd like them to last a while.
I did some tests and found the stock firmware in powered down mode would draw about .35mA. Mine was drawing .75mA. The solution I've found is that I had to set the I/O pins connected to the DS1302 all high (logic 1; which i assume is 'high') before putting the MCU into powered down mode. Now my firmware draws about .35mA too, but I don't get why that is and was wondering if someone could explain that to me.
My thought is by leaving the I/O pins low they're sinking current from the DS1302 and setting them high stops that from happening. The
DS1302 datasheet states "If the CE input is low, all data transfer terminates and the I/O pin goes to a high-impedance state". Shouldn't putting the MCU pin connected to CE low stop any current coming out of the DS1302? That shuts the I/O pin off, and the other two (CE and SCLK) shouldn't be doing anything. I've got to be missing something (probably simple and obvious). What is it?
In looking at the DS1302 datasheet it seems with some small tweaks to the PCB, even more power could be consumed if there was a way to block power to Vcc2 (pin 1) on the DS1302 while in powered down mode, putting the chip into low power mode. Unfortunately both Vcc1 and Vcc2 are tied to the CR2032. I can't cut the trace to Vcc2 because SPI stops working without power to Vcc2.