user84986: I'm using an ESP32 which I connected to a MAX31329 RTC through I2C.
Unfortunately I can't read any register from the RTC. After modifying the MAX31328 library didn't work, I tried reading single registers directly. Here is the code:
#include "Wire.h"

int seconds = 0;
int ret = 0;

void setup() {
  
Serial.begin(115200);
delay(500);

Wire.begin(33,32,100000);

delay(500);
Wire.beginTransmission(0x68);
  Wire.write(0x06);
  Wire.write(13);
  ret = Wire.endTransmission();
  if(ret != 0)
    Serial.println("i2c Setup failed");
    
  delay(500);
}

void loop() {
  
  Wire.beginTransmission(0x68);
  Wire.write(0x06);
  
  Wire.requestFrom(0x68,1);
  seconds = Wire.read();
  ret = Wire.endTransmission();
  if(ret != 0)
    Serial.println("Read failed");
 
  Serial.println(seconds);
  
delay(1000);
}

The register always returns 0.
Do you see the error in my code?
The datasheet of the MAX31329 can be found here.
I'm trying for days now and have no clue what the problem is.
Thanks a lot for your support in advance.
Best regards,
Martin

user10794: You are doing things in the wrong order.

 Wire.beginTransmission(0x68);
 Wire.write(0x06);
 Wire.requestFrom(0x68,1);
 seconds = Wire.read();
 ret = Wire.endTransmission();


The request is sent on the endTransmission call, so you need to do that before trying to get a response. In other words:
  Wire.beginTransmission(0x68);
  Wire.write(0x06);
  ret = Wire.endTransmission();

  Wire.requestFrom(0x68,1);
  seconds = Wire.read();


84986: <p>I'm using an ESP32 which I connected to a MAX31329 RTC through I2C.</p>
<p>Unfortunately I can't read any register from the RTC. After modifying the MAX31328 library didn't work, I tried reading single registers directly. Here is the code:</p>
<pre><code>#include &quot;Wire.h&quot;

int seconds = 0;
int ret = 0;

void setup() {
  
Serial.begin(115200);
delay(500);

Wire.begin(33,32,100000);

delay(500);
Wire.beginTransmission(0x68);
  Wire.write(0x06);
  Wire.write(13);
  ret = Wire.endTransmission();
  if(ret != 0)
    Serial.println(&quot;i2c Setup failed&quot;);
    
  delay(500);
}

void loop() {
  
  Wire.beginTransmission(0x68);
  Wire.write(0x06);
  
  Wire.requestFrom(0x68,1);
  seconds = Wire.read();
  ret = Wire.endTransmission();
  if(ret != 0)
    Serial.println(&quot;Read failed&quot;);
 
  Serial.println(seconds);
  
delay(1000);
}
</code></pre>
<p>The register always returns 0.</p>
<p>Do you see the error in my code?
The datasheet of the MAX31329 can be found <a href="https://datasheets.maximintegrated.com/en/ds/MAX31329.pdf" rel="nofollow noreferrer">here</a>.</p>
<p>I'm trying for days now and have no clue what the problem is.
Thanks a lot for your support in advance.</p>
<p>Best regards,</p>
<p>Martin</p>
 10794: <p>You are doing things in the wrong order.</p>
<blockquote>
<pre><code> Wire.beginTransmission(0x68);
 Wire.write(0x06);
 Wire.requestFrom(0x68,1);
 seconds = Wire.read();
 ret = Wire.endTransmission();
</code></pre>
</blockquote>
<p>The request is sent on the endTransmission call, so you need to do that before trying to get a response. In other words:</p>
<pre><code>  Wire.beginTransmission(0x68);
  Wire.write(0x06);
  ret = Wire.endTransmission();

  Wire.requestFrom(0x68,1);
  seconds = Wire.read();
</code></pre>
