-->
Page 1 of 1

RTC only works after disconnecting

PostPosted: Sat Aug 29, 2015 9:56 am
by MajorMadness
Hello, I've a strange behavor with my DS3231 and cant figure out the Problem:
When I upload a sketch and look at the serial Monitor it sais:
Code: Select all85/165/2009 37:165:

If I disconnect SDA for a second it writes:
Code: Select all01/01/2000 00:06:14

Reboot works fine, its just after uploading a new Sketch I have to disconnect it.
Im useing a brand new ESP-07, Generic and RTC lib from https://github.com/Makuna/Rtc
Code Example: (Minimiced)
Code: Select all#include <Wire.h>
#include <RtcDS3231.h>

RtcDS3231 rtc;
RtcDateTime  t;

void setup() {
  Serial.begin(9600);
    Wire.begin(SDA,SCL); //(Connected to GPIO4,GPIO5)
    rtc.Begin();
}
void loop()
{
    t = rtc.GetDateTime();
    printDateTime(t);
}

#define countof(a) (sizeof(a) / sizeof(a[0]))
void printDateTime(const RtcDateTime& dt)
{
   char datestring[20];

   snprintf_P(datestring,
         countof(datestring),
         PSTR("%02u/%02u/%04u %02u:%02u:%02u"),
         dt.Month(),
         dt.Day(),
         dt.Year(),
         dt.Hour(),
         dt.Minute(),
         dt.Second() );
    Serial.println(datestring);
}

Hope somebody can help me with that...