DS1337 Clock runs fast

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, everyone,

I recently devised a quick project to interface an Attiny2313 with a DS1337 real-time clock from Maxim.

So far, I'm using the Tiny to handle both the time-checking via i2c (using the USI hardware) and the time-displaying via a 4-digit seven segment display.

So far everything is working except for the time-keeping on the DS1337 RTC, which I hoped would be something that would be handled entirely by the chip. Right now, the time is running much faster than normal. 60 seconds of our time is more like 70 seconds on the RTC.

I dug into why the clock might run fast, and I started by replacing the crystal with the correct 6 [pF] 32.768 [kHz] crystal. Still runs fast.

My only other guess at this point is that it has to do with the way my etched PCB is organized.

[/img]

Has anyone else ever had their real-time clock chips from Maxim run fast?

Thanks in advance for reading!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Schematics and code are wonderful things...

EDIT: And those SSD's probably consume lots of power. How do you stabilize V_rtc in your design?

"Maybe happiness is just fragments of existence with better packaging."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have used the DS1337 and DS1337C in many projects and never had such a problem.

In addition to the question posed by hanamegne, I must ask... where are your bypass capacitors?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, those bypass capacitors were something that I left out! I was powering it from my computer's usb port using the ISP itself (from Sparkfun, which can provide power for small projects). How much of a problem does leaving them out cause me? Can I assume that the power from my computer's usb port is stable, or do the bypass capacitors serve another purpose?

Also, my apologies for not including the source code; it's a few files, so I hesitated because of its size.

I'll upload them now.

The important files are:

    main.c: the main loop with an extra function for turning on the right digit

    ds1337_funcs.c: functions for interfacing with the DS1337

    custom_i2c.c: i2c library that uses the Attiny2313's USI
    hardware

    seven_segment_adafruit.h: a quick header file to make heads-and-tails of the digits and their corresponding ports

Many thanks again for taking a look!

Attachment(s): 

Last Edited: Mon. Aug 27, 2012 - 01:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Poofjunior wrote:
Ah, those bypass capacitors were something that I left out! I was powering it from my computer's usb port using the ISP itself (from Sparkfun, which can provide power for small projects). How much of a problem does leaving them out cause me? Can I assume that the power from my computer's usb port is stable, or do the bypass capacitors serve another purpose?

The capacitors that should be connected close to the uC are necessary to reduce high frequency voltage drops caused by the high speed switching in the uC.

Even with a stable voltage from the power supply, the wires or traces running to the uC have inductance that appears as a high impedance to the high frequency current surges caused by the uC switching.

Typically two capacitors, a 0.1uF and a 10uF, are connected between the Vcc and Gnd pins of the uC, as close to the uC as possible with the 0.1uF the closest, to minimize the inductance.

For the DS1337, a single 0.1uF capacitor from the chips Vcc to Gnd pins should be sufficient.

BTW, I was unable to view your schematic pdf. Adobe reader said it was damaged.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, everyone, I can't thank y'all enough! It looks like those two missing capacitors were the only flaws.

It's now keeping the right time!

Thanks so much everyone!

Ah, I wonder how many other key fundamentals I missed on the journey out of Arduino and into AVR uCs. I suppose I'll find out soon enough!

(Lastly, the schematic should be uploaded now, minus those two capacitors)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah yes. The 'Arduino Dream' as I call it.

Don't get me wrong, I think the Arduino team has done an excellent job of porting 'Processing' (Wiring) from the desktop to the avr.

But I also think it is ridiculous to expect...

"artists, designers, hobbyists, and anyone interested in creating interactive objects or environments"

to be able to produce anything useful without some knowledge of electronics.