• AVR Freaks
Reply to post

Hot!MCP7940N Calibration

Author
bbragg
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2014/12/11 12:51:23
  • Location: 0
  • Status: offline
2014/12/11 13:02:39 (permalink)
0

MCP7940N Calibration

I'm using the 7940N and I'm having trouble with calibration.  I've set the SQWE and the RS bits to put out the clock frequency and I get 32.7697KHz on my frequency counter which is just slightly fast.  By my calculations, I need to remove 102 counts per minute from the clock since 1.7Hz * 60 sec/min = 102.  Since each CAL count is worth 2 clocks, I would normally set the CAL register (0x08) to 0x80 | 51.  This should subtract 102 clocks per minute and give me a well calibrated time keeper.
 
However, setting CAL to any value seems to have no effect ... on the frequency out of the MF pin or in the time kept, still too fast.  I'm setting the CAL when the clock is running and I'm wondering if perhaps CAL has to be set with the RTC in stop mode. This isn't mentioned in the datasheet.  Does anyone know if this is the case ... RTC stop to load CAL?  For example, is the CAL value not pulled in from the register until run changes state?
 
I know CAL is getting set to the value as I can read it back as well as any of the other RTC register addresses over I2C.

4 Replies Related Threads

    bbragg
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2014/12/11 12:51:23
    • Location: 0
    • Status: offline
    Re: MCP7940N Calibration 2014/12/14 14:31:36 (permalink)
    3 (1)
    After some experimentation, it appears that the clock must be stopped (ST=0) to properly update the calibration value.  Or at least, to have the updated value recognized.  
    bbragg
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2014/12/11 12:51:23
    • Location: 0
    • Status: offline
    Re: MCP7940N Calibration 2014/12/29 14:21:58 (permalink)
    0
    I was doing it backward.  I needed to set the cal register to 51, not 51 | 0x80.  Once I set it properly, the clock has maintained it's accuracy to the second for a couple of weeks now.  Also, the clock doesn't need to be stopped to set the cal value.  I had an older PDF datasheet that didn't explain any of this very well.  The updated sheet is better.
     
    Thanks.
    AMPS
    Super Member
    • Total Posts : 588
    • Reward points : 0
    • Status: offline
    Re: MCP7940N Calibration 2020/09/05 03:24:13 (permalink)
    2 (1)
    Dear sir,
    Since you have used MCP7940N . can you help me with this thread.  I would like to know
    https://www.microchip.com/forums/m1147677.aspx
    1)Working Circuit weather its correct or not.
    2)weather you have tried MCC generated i2c library to read and write i2c data.
    3) what is accuracy of the MCP7940N
    i have DS1307 which will change 5min variation per month
    DS3231 which is 10S per year variation in timing.
    How about MCP7940N in performance.

    Amps
    *.*.*.*.*.*.*.*.*.*.*.*.*
    Guest
    Super Member
    • Total Posts : 80503
    • Reward points : 0
    • Joined: 2003/01/01 00:00:00
    • Location: 0
    • Status: online
    Re: MCP7940N Calibration 2020/09/14 12:06:08 (permalink)
    5 (1)
    I used the calibration registers and yes, I can read and write via I2C just fine.  I'm backing up the clock with a super cap which will hold me for about 2 days. 
     
    Currently, with recalibrations for temp changes, I'm within 2 seconds a year.  Chip works very well.
    Guest
    Quick Reply: (Open Full Version)
      Enter the random characters shown
    Submit Post
    Some restrictions apply to prevent link (URL) Spam.
    URLs in messages, signatures, and PM's are removed unless you have ...
    • been a member for at least 0 day(s);
    • made a total of 0 post(s);
    • earned at least 0 point(s) for post scores (based on the ratings on your posts);
    • earned at least 0 reward point(s);
    Jump to:
    © 2020 APG vNext Commercial Version 4.5