DS1307 Battery Back-up
Ernie
Posts: 20
I'm doing a little work with the DS1307 Real Time Clock, things are going very well actually, except for...
I can't get the battery backup to work correctly. The RAM values and time registers all hold the last settings, but the oscillator dies, so no time updating is done. The IC stays at whatever time it was when the main power is turned off.
I'm putting a measured 3 VDC into Vbat pin 3 continiously from a pair of watch batteries. The voltage is there, I verified it with a DVM when main power is on and main power off.
·
I can't get the battery backup to work correctly. The RAM values and time registers all hold the last settings, but the oscillator dies, so no time updating is done. The IC stays at whatever time it was when the main power is turned off.
I'm putting a measured 3 VDC into Vbat pin 3 continiously from a pair of watch batteries. The voltage is there, I verified it with a DVM when main power is on and main power off.
·
Comments
mine works just fine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
USB-powered Stamp Board
http://hometown.aol.com/newzed/index.html
·
The battery *DOES* maintain the time data, so it has to be connected.
Just the oscillator seems not·to run during battery backup.
Sid
[/font][font=TimesNewRoman,Bold]V[/font][font=TimesNewRoman,Bold size=1]CC[/font][font=TimesNewRoman,Bold], GND – [/font]DC power is provided to the device on these pins. ... When a 3V battery is connected to the device and VCC is below 1.25 x VBAT, ...the timekeeping function continues unaffected by the lower input voltage. As VCC falls below VBAT the RAM and timekeeper are switched over to ...VBAT.
[font=TimesNewRoman,Bold]SQW/OUT (Square Wave/Output Driver) – ...SQW/OUT will operate with either Vcc or Vbat applied.
I'm not saying you're incorrect Sid, we agree on how the device functions. I am saying the data sheet is thus misleading.
<irony ON>And I'd have to ask if·main purpose of the IC is to be a Clock, why isn't the clock function also on the backup? </irony OFF>[/font][font=Arial,Bold size=4]
[/font]
- Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running
I would interpret this to mean the oscillator is running in back-up mode.▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Bob, Ottawa
W75 54 17·· N45 18 30
·········· G16 #27
I think the output should remain working. My two questions:
1) The clock output appears when Vcc is running, correct?
2) This is an open drain output. Do you have a pull up resistor on it. Remember, the current through the pull up will count against battery life.
Regards,
Al Williams
AWC
Universal Stamp Prototype Board
http://www.awce.com/asp3.htm
·
Some observations:
Be sure the high bit of the seconds register is LOW. Setting that bit HIGH _stops the oscillator_ and drops the current consumption to a few nanoamps. Maybe in your test procedures that bit is getting set back to 1?
When the Vdd power to the chip is off, be sure that the I2C dta and scl lines are low. If not, the clock will do very weird things. If you have pullup resistors on those pins, be sure they pull up to the same voltage that powers the chip at pin 8. For example, if you are supplying the Vdd power to the DS1307 from a Stamp pin, then put the pullups to that same pin, not to your constant 5 volt supply. Do !not! be tempted to use other devices on the same i2c buss when the power to the DS1307 is off.
The Vdd current is nearly 200 microamps to run the I2C interface. The oscillator runs off of the backup battery and only draws 0.5 microamp. On my loggers, the Vdd power to the chip is supplied by a Stamp pin that is only brought HIGH when the system needs to do something with the DS1307. The pullup resistors for dta and scl go to that same pin.
The SQR output needs a pullup resistor, and you have to set byte 7 in memory to $10 to make that pin output a 1hz square wave.
-- Tracy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I'm not using the clock output pin and have left it floating.
I'm using two programs to test the RTC, one that loads the registers, and another program to read them. This way I'm sure I'm not accidentally setting a bit incorrectly.
When I'm reading the device, I have the Stamp looping to read the time and display it on the debug terminal. No writing is done. I remove the Stamp 9V battery, leave the 3V as is, wait some, then plug the battery back in to read the time again... and its as it was before the battery came out.
(I've put a call into Dallas Semi tech support, maybe they know of this phenomina)