JChristensen / DS3232RTC

Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks
GNU General Public License v3.0
392 stars 135 forks source link

I cant get it to work with DUE #67

Closed JPluess closed 4 years ago

JPluess commented 4 years ago

Hi there, it works with leonardo but not with due.

JChristensen commented 4 years ago

Hello,

For non-AVR architectures, it is necessary to instantiate a DS3232RTC object.

Try the following test sketch and let me know how it works for you.

#include <DS3232RTC.h>      // https://github.com/JChristensen/DS3232RTC
DS3232RTC myRTC;

void setup()
{
    Serial.begin(9600);
    myRTC.begin();
    setSyncProvider(myRTC.get);   // the function to get the time from the RTC
    if(timeStatus() != timeSet)
        Serial.println("Unable to sync with the RTC");
    else
        Serial.println("RTC has set the system time");
}

void loop()
{
    digitalClockDisplay();
    delay(10000);
}

void digitalClockDisplay()
{
    // digital clock display of the time
    Serial.print("The current date and time is: ");
    Serial.print(hour());
    Serial.print(':');
    Serial.print(minute());
    Serial.print(':');
    Serial.print(second());
    Serial.print(' ');
    Serial.print(day());
    Serial.print('.');
    Serial.print(month());
    Serial.print('.');
    Serial.print(year());
    Serial.print(" - Temperatur: ");
    Serial.print(myRTC.temperature() / 4.0);
    Serial.print("°C");
    Serial.println();
}
JChristensen commented 4 years ago

Hi again,

I'm afraid I'm at a loss as I do not have a Due board. That is why the library is marked only for AVR architecture (and hence the warning message); my policy is to only indicate those architectures that I have personally tested and am in a position to troubleshoot. Still, I am aware that many of my libraries run fine on various architectures.

Seems pretty extreme that just defining the object causes such an issue. Just a shot in the dark, but if you instead define the object as: DS3232RTC myRTC(false); does that help at all?

JPluess commented 4 years ago

hi dear, yes i got it to work.

some libs use sda1 scl1 yours is on sda0 scl0 so i did not have any success there. i found the false statement to be working, otherwise the cpu would not run.

if you want i donate a due board to you from china. i am grateful for your help

i uploaded the sketch setserial, it would look like it set but since i had it on the other i2c it would not communicate to the ds3231 the serial would not show an issue.

thanks so much. i feel relieved.