1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

DS3231 Initialization

Discussion in 'Microcontrollers' started by Gayan Soyza, Jun 15, 2017.

  1. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,821
    Likes:
    19
    Location:
    Colombo
    Guys I have a problem with DS3231 chip. Made a clock with a cheap Ebay module & it worked fine.

    After 1 month of continuous run the time halted. After searching the internet found that the crude charging circuit & the battery gives lots of problems & need to remove the crude Li cells charging circuit on these modules. I modified the circuit & placed a new CR2032 battery.

    The problem is in a good A/C condition (cool) the time works fine. At home (Hot) the time holds & not counting. The time increments sometimes very slowly.

    I just guess does the Aging Register have some garbage values after my battery issue? Do you guys set this register when power up the chip?
     

    Attached Files:

  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Gayan,
    I have used a number of these modules for many, many months, all OK.
    The only problem was that the initial CR2032 cell that was supplied with the modules failed after after about a month, I guess it is the same as many manufacturers, they use cheap batteries in order to keep the costs down.

    I have had no problems with the charging circuits, so far.

    I suspect your problem is the inbuilt crystal oscillator, which is failing when the DS3231 gets 'hot'.

    The ageing register programming just adds/subtracts very low value capacitors connected in parallel with main cap, which I understand is about 6pF.
    The ageing register is normally trimmed/set by the manufacturer, you can add/subtract oscillator capacitance to adjust for a 'fast/slow' clock.
    I do not set the ageing reg at power up.

    Eric
    Attached a copy of the DS3231 PDF.
    A001.gif
     

    Attached Files:

    Last edited: Jun 16, 2017
  3. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,821
    Likes:
    19
    Location:
    Colombo
    Hi Eric thanks for the details.

    That's a very sad story.I ordered 20 modules of these & I have those modules at the moment.In my clock I just use this module as a plug in type.With this type of errors I cannot use this module :(

    I still use the DS1307 code.Not even touching the CONTROL registers in DS3231 because the Oscillator Enable is active when first powered up.

    I still wondering the factory value of the Aging register or may be its coming with a value of "0" :(
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK

    hi,
    You could test read register 10h, in order to check the age reg value.
    Note it will change with temperature.

    I assume that you have pull up resistors on the SCL and SDA line.??

    E
     

    Attached Files:

  6. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,821
    Likes:
    19
    Location:
    Colombo
    Hi Eric.

    You are correct.I just checked the module in office room temperature 22'C working nicely.
    Checked the module in stores temperature 30'C the clock slows down.

    I'm really dissapointed.
     
  7. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,641
    Likes:
    245
    Location:
    North west UK
    I have some too, and they were supplied with non rechargeable batteries.
    I never messed with the xtal age register, as far as I know it auto updates.
    If you just have the one faulty, bin it and try again, might just be a one off.
     
  8. Gayan Soyza

    Gayan Soyza Active Member

    Joined:
    Oct 23, 2006
    Messages:
    1,821
    Likes:
    19
    Location:
    Colombo
    I also monitored the Aging register values of my other modules using a serial monitor.It shows value of "0".Even though if I remove the battery & check the aging value is still 0.Will se how it goes :) Still wondering how this chip got this problem..!!
     

    Attached Files:

    Last edited: Jun 17, 2017
    • Informative Informative x 1
  9. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,641
    Likes:
    245
    Location:
    North west UK
    Are you sure the age register is actually readable.
     

Share This Page