Shop OBEX P1 Docs P2 Docs Learn Events
Problems with DS1302 — Parallax Forums

Problems with DS1302

imekonimekon Posts: 6
edited 2009-11-29 22:32 in Propeller 1
I'm having issues with a DS1302 I have wired to a Propeller chip - usually when I hook up to the board with a prop clip, the clock appears to be lagging behind a few minutes (in one case several hours). Yesterday, it was about 20 minutes ahead!

I've also seen the clock stop ticking. I'm using DS1302_full, like this:

  { The DS1302 Real Time Clock }
  RTC_CLOCK = 5
  RTC_IO = 6
  RTC_ENABLE = 7

  { Start the RTC }
  rtc.init( RTC_CLOCK, RTC_IO, RTC_ENABLE )
  rtc.config




I did make a small change to DS1302_full, to turn off the tickle charging of the 3.2v battery attached

PUB config
''Config DS1302.  Call once after DS1302 power-up.
''Usage: rtc.config

  write(command(clock,ctrl,w),0)             'clear write-protect bit
  write(command(clock,sec,w),0)              'clear clock halt bit (MSB of seconds register)
  write(command(clock,sec,w),0)              'set 24h mode

'Trickle charger setup - OFF
  write(command(clock,tc,w),0) 

'Examples of other useful config and control commands
'write(command(clock,sec,w),%1000_0000)      'set clock halt bit
'write(command(clock,ctrl,w),%1000_0000)     'set write-protect bit
'write(command(clock,sec,w),read(command(clock,sec,r))&%1000_0000) 'set 24h mode bit without resetting the other 7 bits

Comments

  • BRBR Posts: 92
    edited 2009-11-29 22:32
    That's strange. Can you describe your setup a bit more? Are you running the DS1302 off a power supply or off the 3.2V battery you mentioned? Prop demo board or proto board? Is it possible that the voltage is sagging or there is some kind of brown out condition or a bad connection somehow? Maybe you're getting an inadvertent reset when you hook/unhook the prop clip to the board?

    You might try disconnecting the 3.2V battery and seeing if that makes the problem go away (presuming you're using it as the backup, not as the primary power source).
Sign In or Register to comment.