PIC and RTC DS1307 problem - hardware vs software ?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Posts
    25

    Lightbulb PIC and RTC DS1307 problem - hardware vs software ?

    Hi everyone ( specially Melabs PBP PRO´s )

    i ve almost a two years old project that suffers from specific a RTC problem that i ve been unable to workaround .. All the RTC program routines and PIC code are working ok and this only happens once in a while. Capacitors on power leads ( 10uf) and system gets power from a standard SMD LM7805 with 100uf !! capacitors.
    Standard DS1307 to PIC ( from manufacturer app note) schematics used.

    The problem is that from time to time (without any specific reason – noise I guess… ) the dallas RTC DS1307 get´s all it ´s internal data corrupted and i ve to program it again with valid clock and date settings.
    Fist I manage to insert an auto-routine that when detect that no valid data was inside the RTC anymore it would program it with the manufacture date and alert the user to set date/time again asap.
    This would be fine, but creates another problem….until the user sets the current clock&date again, all the data after the this “auto-date” solution must be cross reference to the last valid RTC reading to extrapolate the actual date of the recordings of all the probes values… ( otherwise all the new values are referenced / starting based in the manufactured auto start date)

    Last note: the DS1307 battery is assembled and in good condition all the times.


    So, my question(s) are:

    -i know that the DS1307 can suffer from similar problems in noisy conditions or when a bad write command is given and gets interrupted ( which doesn’t seem to be the case), but can I ve any hardware solution or a cleaver software workaround to this ?

    - Any of you PRO´s had any similar problem with the DS1307 RTC and/or have any “advice” in terms of schematics?

    Thanks in advance for any help !:-)

    Any advice or information would be really good.

    Regards,
    Jorge
    Last edited by jorge; - 5th April 2011 at 23:12.

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile Re: PIC and RTC DS1307 problem - hardware vs software ?

    Hi Jorge,

    Do you have more than one of these units made? If so is the same problem happening to each of them or only the one unit? Do you have any capacitors on the power leads? .1uF AND 10uF?

    I personally haven't used this particular RTC but do use the DS1337. I've had 80 of them out in the field and aside from gaining/losing time over a two year period, there hasn't been any problems. I keep three of them at home and only leave them running on a 2032 battery. Then a week or two before the DST changes I power them up and check on the time and it has been fairly good. I cycle the main power on and off several times whenever I can just looking for problems like you mention but haven't encountered anything yet.

    Care to share the schematic and some code?

    BobK

  3. #3
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: PIC and RTC DS1307 problem - hardware vs software ?

    I use the DS1307. Power on/off will corrupt register if connect/disconnect is too noisy causing the DS1307 to go no/off battery too rapidly. Use a clean toggle power switch. Worked for me.

  4. #4
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Lightbulb Re: PIC and RTC DS1307 problem - hardware vs software ?

    Jorge,

    I use the DS1307 and this problem already occurred with me in the past. My project is the POV Clock by Pimentel from community competition (look in this site). In my case was the current colapse, then I needed to increase my power (12 to 13.5v) because I was using a fet wired in the coil (transformer with air nucleus and it needed more volts to work fine. I don't know if when your circuit loose the data is because your hardware is consuming more current...but with me it occurred!
    Other thing that may be the BROWNOUT RESET config. Is ON or OFF? Try OFF !

    Pimentel
    Last edited by Pimentel; - 6th April 2011 at 11:50. Reason: interrogation signal missing

  5. #5
    Join Date
    Nov 2004
    Posts
    25


    Did you find this post helpful? Yes | No

    Default Re: PIC and RTC DS1307 problem - hardware vs software ?

    thanks for all the advices !

    i guess my problem is really in the powersupply that makes DS1307 reset and looses all the settings (even with the 3v coin cell battery ) , but i was hoping some software magic to workaround this.

    Just a doubt, why should the BROWNOUT RESET setting make it more reliable in noise related problems ?!?
    thanks again for all answers!

  6. #6
    Join Date
    Jul 2005
    Location
    Midwest
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: PIC and RTC DS1307 problem - hardware vs software ?

    I had this issue long ago with many DS1307's. I found a Dallas app note that suggests a large negative going spike on the supply rail will corrupt the clock. I verified with a scope that upon power up my supply was indeed going negative by five or ten volts. I put a shottky across the 5 volt line to clamp the negative spike and have not had a re occurrence of the corruption in many years. See the last page of the attached app note.
    Attached Images Attached Images

  7. #7
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: PIC and RTC DS1307 problem - hardware vs software ?

    Quote Originally Posted by jorge View Post
    thanks for all the advices !

    i guess my problem is really in the powersupply that makes DS1307 reset and looses all the settings (even with the 3v coin cell battery ) , but i was hoping some software magic to workaround this.

    Just a doubt, why should the BROWNOUT RESET setting make it more reliable in noise related problems ?!?
    thanks again for all answers!
    I think that your circuit reset the PIC when the noise occurs! For example, if the VDD down it can reset the PIC , by something with current consume, a rele, a servo, step motor, or a noise by power as an oscilation on Vout...With me occured this problem when was using a servo. Then I change the BOR to off and solved my problem...then I suggested it to you. I think that would be more robust to the noises, therefore reset I could be occurring when pic is in communicating with RTC.

    It is a part of datasheet of 16f877A...
    12.7 Brown-out Reset (BOR)
    The configuration bit, BODEN, can enable or disable
    the Brown-out Reset circuit. If VDD falls below VBOR
    (parameter D005, about 4V) for longer than TBOR
    (parameter #35, about 100μS), the brown-out situation
    will reset the device. If VDD falls below VBOR for less
    than TBOR, a RESET may not occur.
    Once the brown-out occurs, the device will remain in
    Brown-out Reset until VDD rises above VBOR. The
    Power-up Timer then keeps the device in RESET for
    TPWRT (parameter #33, about 72mS). If VDD should fall
    below VBOR during TPWRT, the Brown-out Reset process
    will restart when VDD rises above VBOR with the
    Power-up Timer Reset. The Power-up Timer is always
    enabled when the Brown-out Reset circuit is enabled,
    regardless of the state of the PWRT configuration bit.

    Good luck

    Pimentel
    Last edited by Pimentel; - 8th April 2011 at 04:31. Reason: correction

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts