View Full Version : Clock running fast on PPDB

11-01-2010, 04:52 PM
Hello All,

I'm a new Propellerhead and I am trying to build a clock with the Propeller Professional Development Board. I am using the DS1302 that is provided on the board. Instead of using the board's own 16 segment displays, I wired up some of my own on the breadboard so that I can learn how they work and also as a protection to not break the ones on the board as I am learning.

As far as the time keeping goes, I have studied some code for the DS1302 that SEL wrote and decided to write my own as an educational excercise and to be able to say that I did it. I got it all working last night and left the clock on overnight to see if it kept time well. I noticed before I went to bed that it seemed to be speeding up slightly. When I woke up it had gained 2-3 seconds in about 7 hours. I'm not sure if this is within spec or not but it seems like it wouldn't be because a clock like this would gain 3 or more minutes in a month.

For reference, I was using the clock on my 2008 Dell desktop computer as a reference time piece. Maybe next time I try to measure the clock I should use one of the atomic clocks that are out there on the internet.

I did some investigation on the forums and found this thread:

...which has some discussion about a fast clock using this chip. Most of the application notes I think wouldn't apply to me because I am assuming that Parallax used them when designing the PPDB. There is one that I am wondering about though. One suggestion was to include a capacitor across the power input to the chip to prevent external circuit noise from entering the time section. I noticed in the PPDB schematic that there is no capacitor across pins 1 (Vdd) and 4 (Gnd) of the DS1302 RTC.

Does anyone have any ideas what I might look at to troubleshoot the fast clock problem? Is the fact that no capacitor is provided on the PPDB a concern? FYI, my PPDB was one of the blemished units that was sold within the past month.


11-01-2010, 04:54 PM
I should also add, I am using a power supply that is not from Parallax. It is a 12V adapter that supplies something like 12.65 when unloaded (if I recall correctly).

11-01-2010, 04:56 PM
Here is the schematic of the RTC from the PPDB schematic PDF.


Phil Pilgrim (PhiPi)
11-01-2010, 05:02 PM
Frequency accuracy depends on the crystal tolerance, stability, and temperature variation. Two to three seconds in seven hours is on the order of 100ppm, which is a typical tolerance for some crystals. You could try a crystal with tighter tolerances and see if that helps. DigiKey, for example, has offerings down to 5ppm.


11-01-2010, 05:09 PM
From what I've read online the accuracy you are seeing seems about right for that particular part. For some applications that may be ok. If you need much tighter timekeeping then you may want to look at a different time keeping module to connect to the propeller. It's been a while since I've looked at the different modules but as I recall the cost goes up exponentially as the accuracy goes up.

Here are some sites that talk about the accuracy of the DS1302 chip:





11-01-2010, 09:37 PM
Thanks guys, I will look into this. A possible fun solution might be to add atomic syncing capabilities.

One more question I just thought of. Is the lack of accuracy really due to the selection of a DS1302? Couldn't you get a better crystal and be very accurate (assuming you only need granularity down to the second?) Could somebody riff on the accuracy benefits of a "better" RTC part (not the crystal) for a few sentences?

11-01-2010, 09:56 PM
Well, for your application are you going to keep the temperature constant?? Temperature differences can affect the crystal a bit. It is discussed here:


It should explain some of the benefits that you are asking about.

11-02-2010, 02:09 AM
Cool, thanks for the link. That DS3231 seems pretty cool if you need to get accurate. I like the integrated crystal.

Toby Seckshund
11-02-2010, 09:42 AM
If the clock is running fast then it could be worth a try to slow down the 32K xtal a bit with some loading capacitors. Two caps either side of the xtal would lower its frequency, but I do not know how much these rocks and chips could suffer before the oscillation would stop / not start.

Stick a couple of 30pF ones on and see if anything changes, and then if successful some calibration might be possible.