ESP32 and a DS3231 (I2C)

Hi,
Has anyone come across something like this before ...
It is a simple I2C connection between an ESP32 and a DS3231 (typical one to be found on e-bay)

The code, simplified. (extraneous stuff removed until needed) :

#include <RTClib.h>

RTC_DS3231 rtc ;

setup() {

Wire.begin()    ; 
Serial.begin(115200);

In_a _sub {

if(!rtc.begin()) {
Serial.println("Couldn't find RTC!");
return false ;
}

OK. here is the problem ...

rtc.begin() fails.

BUT ...

Running I2CScanner (within my setup() routine before attempting to initialise the clock identifies something at 0x68 (my Clock))

Clock initialisation fails with an I2C timeout error and other of related failure messages

THEN ...

Asking RTC for the time later returns just what one would expect - THE TIME! (according to itself! But not set with my values))

It is as though I have the worlds first "read only" (DS3231) clock!

The current time is ... "whatever time I have available from ages ago" (so RTC is actually working, sort of)...

Should I ...
a) keep on trying to "debug" my code and work out what is going on
b) Just buy a new one?

Is it even possible that the (I2C) R/W bit is not happening?

In writing I thought of something I had changed.

In trying to run both the ESP32 and RTC on 3.3V I put a couple of 2K2 resistors in to pull up the I2C lines.

Could that be my problem when writing? Presumably, the whole configuration changes depending upon what end is driving the bus at the time.

Read - bus well within specs. Write ... ?

c) Read the forum guide in the sticky post and follow the advice there?

That one.

1 Like

These have the RTC and an EEPROM chip on the module, so the scanner should see 2 addresses.

Topic closed as the OP won't be able to reply.

Abuse removed.

1 Like