RTC not counting up.

I can set the time on the RTC and retreive it but the value never changes. After some digging I found that it may have something to do with setting the ST bit. I've tried the following bit of code but that hasn't solved the problem:

  const int MCP7940_I2C  = 0x6F;  // I2C Address for the RTC
  const int REG_RTCSEC   = 0x00;  // Register Address: Time Second
  
  Wire.requestFrom(MCP7940_I2C,7);
  registerValue = Wire.read();
  if (startClock == 0x00){
    Wire.beginTransmission(MCP7940_I2C);
    Wire.write(REG_RTCSEC);
    Wire.write(bitClear (registerValue, 7));
    Wire.endTransmission();
  }
  if (startClock == 0x01){
    Wire.beginTransmission(MCP7940_I2C);
    Wire.write(REG_RTCSEC);
    Wire.write(bitSet(registerValue, 7));
    Wire.endTransmission();
  }

How do I start this clock?

 

I2C
Craig Gunthorpe
Craig Gunthorpe
10
| 2 1 2
Asked on 3/28/19, 8:14 PM
0
vote
2772 Views

Hi, can you please try with our example https://github.com/Industruino/democode/blob/master/rtc_D21G/rtc_D21G.ino

Features are documented at https://github.com/Industruino/documentation/blob/master/indio.md

Please make sure to insert a coin battery to make the RTC work.

Tom
Tom
5675
| 1 1 3
Answered on 3/29/19, 12:04 AM
0
vote

Thanks for your answer Tom. I haven't had any luck with that. I think the clock is working, I just need to start the oscillator by setting bit 7 at 0x00 to 1. Apparently this is a common problem with this chip. I'm not sure how to do that, however.

Craig Gunthorpe
on 3/29/19, 5:45 AM

can you please confirm what happens when you upload the demo sketch i linked to above, with screenshot of the serial monitor output. please send to connect@industruino.com so we can follow up

Tom
on 3/29/19, 7:24 AM

I have the same problem. Have you resolve it? With library "MCP7940-RTC-Library-master" and the example https://github.com/Industruino/democode/blob/master/rtc_D21G/rtc_D21G.ino the value never change 15:56:16.033 -> THU 29 aug 2019 15:56:16.066 -> 14:12:00 15:56:16.066 -> 15:56:17.061 -> THU 29 aug 2019 15:56:17.061 -> 14:12:00 15:56:17.061 -> 15:56:18.055 -> THU 29 aug 2019 15:56:18.088 -> 14:12:00 15:56:18.088 -> 15:56:19.084 -> THU 29 aug 2019 15:56:19.084 -> 14:12:00 15:56:19.084 -> 15:56:20.078 -> THU 29 aug 2019 15:56:20.111 -> 14:12:00 15:56:20.111 -> 15:56:21.106 -> THU 29 aug 2019 15:56:21.106 -> 14:12:00 15:56:21.106 -> 15:56:22.134 -> THU 29 aug 2019 15:56:22.134 -> 14:12:00 15:56:22.134 -> 15:56:23.128 -> THU 29 aug 2019 15:56:23.128 -> 14:12:00 15:56:23.128 -> 15:56:24.156 -> THU 29 aug 2019 15:56:24.156 -> 14:12:00 15:56:24.156 ->

Jose Fructuoso Gabarrón
on 8/29/19, 2:14 PM

Hi Jose, that does not look like the output of the linked sketch, can you upload the exact demo sketch, with screenshot of the serial monitor output. please send to connect@industruino.com so we can follow up make sure you are using our version of the library https://github.com/Industruino/MCP7940-RTC-Library

Tom
on 8/29/19, 11:38 PM

Hi Tom, I've tried running the sample code and used the library as given above, and even insert a coin battery, but still, the RTC is not counting up. In fact, I had to comment out this line in Setup() to make sure it updates the set time: RTCind.get(rtc,true); The output obtained from running serial_clock with above amendment: MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 ..... (and the list goes on, but not updated) Any idea why? Thanks

Ammar
on 10/6/19, 3:00 AM

Hi Tom, I've tried running the sample code and used the library as given above, and even insert a coin battery, but still, the RTC is not counting up. In fact, I had to comment out this line in Setup() to make sure it updates the set time: RTCind.get(rtc,true); The output obtained from running serial_clock with above amendment: MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 MON 27 jan 2014 18:13:00 ..... (and the list goes on, but not updated) Any idea why? Thanks

Ammar
on 10/6/19, 3:00 AM

Hi All, I'm out of office until the 7/10. I have a limited access to my email. It could be take some time to receive an answer.

 

For urgent matter for Belgium contact +32 4 270 4700, For Luxemburg & International + 352 26 90 89 38 or support@cybernet.be

 

Regards

 

Armand FUMAL CEO Cybernet International SARL.

Armand Fumal
on 10/6/19, 3:00 AM
Craig Gunthorpe
Craig Gunthorpe
10
| 2 1 2
Answered on 3/31/19, 9:32 AM
0
vote

Just to follow up, the MCP7940N is showing an oscillator failure (OSCRUN). Looks like a hardware problem. 

Craig Gunthorpe
Craig Gunthorpe
10
| 2 1 2
Answered on 3/31/19, 9:32 AM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

55 follower(s)

Stats

Asked: 3/28/19, 8:14 PM
Seen: 2772 times
Last updated: 3/31/19, 9:33 AM