PDA

View Full Version : - DS1302 Clock is losing time.



Mrdavidjenkins
08-03-2005, 02:43 AM
I am using the DS1302 chip with a battery backup to keep time with a basic sx.· ·Just finished the project last night and ·unplugged the power to the basic stamp.· This morning, the time was off by 20 minutes - that is, the 1302 read 1:30 PM when the time was actually 1:50 pm.· I am using a CR2025 3 volt button type battery.· The backup is only a backup for when the unit needs servicing.

I will leave the basic stamp on AC power tonite to see if there is a problem only with the backup , but I have a couple of questions.

1)· Is there a way to tweak the 1302 to get better times?

2)··Has anyone else seen this kind of problem and how did they resolve it?·

Thanks

Dave

dandreae
08-03-2005, 02:55 AM
You need to make sure that you are using the correct crystal and also make sure that the crystal is super close the pins on the DS1302.· Here is a link for the crystal that you should be using:· http://www.parallax.com/detail.asp?product_id=251-03230 .· We solder our crystals right to the pins of the DS1302.·


Dave


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae

Tech Support
dandreae@parallax.com (mailto:dandreae@parallax.com)
http://www.parallax.com

·

Mrdavidjenkins
08-03-2005, 03:21 AM
Thanks for the tip. I have used the parallax crystals and, as you suggested, soldered the crystal directly onto the pins on this project. Using some silicon rubber to hold the crystal ontop of the 1302.

Chris Savage
08-03-2005, 04:06 AM
David,

·· I have several clocks using the DS1302 and each has been left overnight and sometimes a couple of days with just the battery backup on the DS1302.· None of them were ever off by more than a second.· Just curious, which pin are you connecting the battery to, and is it connected to anything else?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Mrdavidjenkins
08-03-2005, 04:14 AM
Hi Chris,

Here are the pins

0 Data IO
1 Clock
2 Chip Select
3 LCD for Seetron lcd

Thanks.
Dave

Chris Savage
08-03-2005, 04:16 AM
David,

·· What I meant was, which pin is the backup battery connected to, and is it connected to anything else?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Mrdavidjenkins
08-03-2005, 04:33 AM
CHris,

Okay - I looked and verified

Pin 1 5volt
Pin 2 crystal 1
Pin 3 crystal 2
Pin 4 grnd
Pin 5 basic pin2
Pin 6 basic pin0
Pin 7 basic pin1
Pin 8 3 volt battery

Do you think I might have the pins reversed. Here is a snipit of the code.


DataIO PIN 0 ' DS1302.6
Clock PIN 1 ' DS1302.7
CS1302 PIN 2 ' DS1302.5


Thanks again for your help. My guess is that the crystal might be off or damaged by my ham - handed soldering. Either that or the crystal sees heat from the clock. I will try another 1302 and crystal tomorrow if the time results warrent.

Chris Savage
08-03-2005, 04:49 AM
David,

·· Your connections are correct.· I don't know what's going on.· I've never had those problems.

EDIT:· I checked on the crystal, and if you are using the crystal we sell, then it has to be something else...Is the battery at 3V?· What about your code?· Are you turning on the trickle charger or anything like that?· Are you using the write-protect when you're not updating the time?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)


Post Edited (Chris Savage (Parallax)) : 8/2/2005 10:07:00 PM GMT

deno
08-03-2005, 05:53 AM
Just to add alittle to the backup power supply for the ds1302...I use a 1 farad super cap (from Jameco) and set the trickle charge register for one resistor and one diode.· I have powered down the ds1302 (everything off including the stamp) and left it for over a week. Power up, and the time is right on the money.

My 2 cents worth...

Deno

PS...the super cap does charge up close to 5 volts.

Mrdavidjenkins
08-03-2005, 07:13 AM
Neat technique. I will try it a little later. By the way, I have lost NO time after 3 hours on DC. I expected to lose about 5 minutes, so I am pretty happy with that. I will address the backup battery in a few days - I appreciate all of your help.

Dave

Forrest
08-03-2005, 09:22 AM
Check out the notes on page 4 of the DS1302 datasheet. It looks like placing the crystal on top of the chip may cause some interference www.maxim-ic.com/quick_view2.cfm/qv_pk/2685 (http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2685)