Shop OBEX P1 Docs P2 Docs Learn Events
DS1307 Battery Back-up — Parallax Forums

DS1307 Battery Back-up

ErnieErnie Posts: 20
edited 2004-08-29 00:33 in BASIC Stamp
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.

·

Comments

  • NewzedNewzed Posts: 2,503
    edited 2004-08-11 16:39
    Did you verify battery polarity?· Does the battery ground go to Pin 4 of the 1307?

    mine works just fine.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    USB-powered Stamp Board

    http://hometown.aol.com/newzed/index.html
    ·
  • ErnieErnie Posts: 20
    edited 2004-08-11 16:47
    Polarity is just fine, ground is intact. I just tripple checked.

    The battery *DOES* maintain the time data, so it has to be connected.

    Just the oscillator seems not·to run during battery backup.
  • NewzedNewzed Posts: 2,503
    edited 2004-08-11 17:00
    The oscillator will·NOT run during battery backup.· The bttery only keeps the clock alive.



    Sid
  • ErnieErnie Posts: 20
    edited 2004-08-11 17:47
    Newzed said...

    The oscillator will·NOT run during battery backup.· The bttery only keeps the clock alive.



    Sid

    That's just what I'm seeing. Now while the Dallas Semi datasheet does not explicitely say the oscillator is run off battery power in the features list, there are several indirect referals to it doing just so:
    [font=Arial,Bold size=4]SIGNAL DESCRIPTIONS
    [/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]
  • bobhillierbobhillier Posts: 27
    edited 2004-08-11 18:30
    The spec sheet for this device states:

    • 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
  • AlWilliamsAWCAlWilliamsAWC Posts: 135
    edited 2004-08-11 19:22
    This is the month for DS13xx clocks -- the Stamp Project of the Month (http://www.awce.com/som.htm) uses one this month.

    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
    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2004-08-11 19:44
    The DS1307 certainly will keep running on the battery backup--that is really the whole point!! I use these on hundreds of data loggers, and I know that they do run and draw less than 1 microamp from the backup battery.

    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
  • ErnieErnie Posts: 20
    edited 2004-08-11 21:12
    Tracy Allen said...
    The DS1307 certainly will keep running on the battery backup--that is really the whole point!!

    -- Tracy
    Thanks Tracy (and everyone else too, the info is very comforting), that confirms what I thought, it *should* keep on trucking.

    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)
  • DToolanDToolan Posts: 11
    edited 2004-08-29 00:33
    I have the same problem....
Sign In or Register to comment.