LED Clock: DS1302 Unworking

I did some refactoring on the DS1302 code last night: moved driver code into a library, demo code into a program, wrote some print routines to send single nicely-formatted times to the LogoChip console, updated the Makefile, etc. I had a few minutes before breakfast today, so I went to my workbench to see whether the 1302 still had correct time.

Unfortunately, I found I had left my bench power supply on, so I didn’t get a real test of the backup battery. Stranger than that, I was getting garbage data from the 1302 again, and changing the data clock timing didn’t have any impact.

Strangest yet, when I shut down the bench power supply to see how the garbage would change when the 1302 was off, I started getting the correct time. This seems especially strange, as most timekeeping chips shut off all communications and go into a powersaving mode when primary power disappears.


Turn it back on, garbage. Off again, correct time.

The only thing that even halfway makes sense is if I had VCC2 and VCC1 swapped, and the chip was using the power supply as a backup power source when the battery failed (ha ha). But I’ve checked and checked, and I have power to VCC2 (pin 8 ) and battery to VCC1 (pin 1), which is what the datasheet says, even though the designations seem backward to me.

Not sure how to go about troubleshooting this, but maybe something will come to me by the time I get back to it.

Leave a Reply