ds3231sn real time clock program gets stuck

Hi everyone,
i recently bought a ds3231sn RTC and I encountered a problem.
I’m using the DS3231.h Library by Henning Karlsen
I ran the example sketch “easy” on my Ardu Uno R3 but the program gets stuck when
executing one line of code that has to do with the rtc.
I used the Serial monitor to find where the progrsm gets stuck, and here’s what happened:

#include <DS3231.h>

DS3231  rtc(SDA, SCL);

void setup(){
  Serial.begin(115200);
  rtc.begin();
}

void loop(){
  
  Serial.println(1); // <---

  // Send Day of Week
  Serial.print(rtc.getDOWStr());
  
  Serial.println(2);  // <---

  // Send Date
  Serial.print(" ");
  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  // Send time
  Serial.println(rtc.getTimeStr());
  
  // Wait one second before repeating :)
  delay (1000);
}

The serial monitor only shows the 1 but not the 2, indicating that the function rtc.getDateStr() is the problem. The arduino stops doing what ever it is doing and doesn’t react. It’s not a compiler error, since the code uploads tothe ardu as usual. The code is just the example code that comes with the library, but it doesn’t work for me, any suggestions?

Thanks in advance!

You have the source code for the class that rtc is an instance of. You can add Serial.print() statements there, too. In fact, doing so would be a good idea...

Run an I2C scanner. If it can't find the RTC then you have your answer - wiring is wrong.

Pete