CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Best way to achieve accuracy with DS1307

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jojos



Joined: 30 Apr 2007
Posts: 64

View user's profile Send private message

Best way to achieve accuracy with DS1307
PostPosted: Thu Jun 04, 2009 1:54 am     Reply with quote

Hello i am using DS1307 RTC on my project. I noticed time inaccuracy. Lets say in 1 week time has been inaccurate for about a minute. I used the clock from my computer to do the comparison. I have connected with my crystal two 12 pF capacitors and two 10 K pull up resistors for the data. The Vbat derives from a 3V Panasonic CR2032 battery. I measured my crystal's frequency with a frequency meter and I got 32.7675 KHz. Any thoughts? Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 04, 2009 2:33 am     Reply with quote

Quote:
I used the clock from my computer to do the comparison.

That's not a good idea. PC computer clocks are very often inaccurate.
They don't keep the correct time.


Quote:

I have connected with my crystal two 12 pF capacitors and two 10 K pull
up resistors for the data.

That's wrong. The ds1307 data sheet says to use a crystal with a load
capacitance of 12.5 pf. It does not say to use external capacitors.
Look at the schematic on the first page of the data sheet. It doesn't
show any external capacitors.
http://datasheets.maxim-ic.com/en/ds/DS1307.pdf
jojos



Joined: 30 Apr 2007
Posts: 64

View user's profile Send private message

PostPosted: Thu Jun 04, 2009 2:53 am     Reply with quote

Thank you PCM Programmer for your quick response. I will check with another clock than mine computer's clock to make my comparisons. Also I will remove the external crystals. Thanks again.

Last edited by jojos on Thu Jun 04, 2009 3:10 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 04, 2009 3:10 am     Reply with quote

Quote:
I measured my crystal with a capacitance meter and it showed 2.8 pF.

That's not the way to determine the load capacitance. You should look
at the data sheet for the crystal. Your basic problem is that you are
doing too many things with meters, and you are not reading the data
sheets enough.


Quote:
Also are there particular crystals which i can order with this specific capacitance

Yes, there are. Go to http://www.digikey.com/ and put in the following
text in the search box:
Quote:
CRYSTAL 32.768 KHZ 12.5PF CYL 20PPM

Click the Search button.
In the next screen, click on "In Stock" and select "Surface Mount" or
"Through Hole" (whichever one you want), and click Search.
You should now see many crystals that will work.

If you want more accuracy, you can change the search terms to use:
Quote:
CRYSTAL 32.768 KHZ 12.5PF 10PPM

The 10 ppm crystals are only available in surface mount. That's why
I deleted the "CYL" term.
jojos



Joined: 30 Apr 2007
Posts: 64

View user's profile Send private message

PostPosted: Thu Jun 04, 2009 3:13 am     Reply with quote

You are correct. I can't measure the capacitance of the crystal correctly. That's why I changed my previous post. I checked the datasheet of my crystal. It has type DT-38. I saw that it has 12.5 pF and +20 ppm.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 04, 2009 3:16 am     Reply with quote

Well, good. Then get rid of the external caps and it might work.
Ttelmah
Guest







PostPosted: Thu Jun 04, 2009 3:18 am     Reply with quote

The apparent capacitance of a crystal, is _not_ it's load capacitance.

Realistically, getting accuracy with the DS1307, is down to buying the right crystal, with the accuracy level specified, and ensuring that your board layout is good around the crystal pins in particular. If you can't get the level of accuracy you require as a spec, then you have to look at more expensive solutions.

Measuring the crystal with a frequency meter, is not the way to check it, if you are going onto the crystal pins. Unfortunately the capacitance of the frequency meter probe, _will_ change the frequency. You should program the 1307, to output it's clock, on the SQW pin, and measure this. You will also need to check/calibrate the frequency meter before starting. A typical watch crystal, give about 20ppm, and do better than this, _when kept at a reasonably constant 'body' temperature_. You should be able to get units down to about 5ppm, without spending too much more. Going beyond this, then moves into needing a crystal oven.
You should be able to get a couple of seconds a day, as a 'routine' accuracy, with little cost. Any crystal supplier, or major electronic wholesaler, will have hundreds of crystals matching this. If (for example), you go to digikey, put 32768Hz, 12.5pF as 'search criteria', you get nearly 200 'hits'. Narrow it with through hole, or surface mount according to your board technology.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group