2014/12/11 13:02:39
bbragg
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.
2014/12/14 14:31:36
bbragg
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.  
2014/12/29 14:21:58
bbragg
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.
2020/09/05 03:24:13
AMPS
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.
2020/09/14 12:06:08
Guest
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.
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account