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
| 0 0 0
Asked on 3/28/19, 8:14 PM
0
vote
79 Views

Craig Gunthorpe
Craig Gunthorpe
10
| 0 0 0
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
| 0 0 0
Answered on 3/31/19, 9:32 AM
0
vote

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
5375
| 0 0 1
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

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: 79 times
Last updated: 3/31/19, 9:33 AM