I2C - Reading at a specific register address

I'm playing with an SGM31323 LED driver (https://www.sg-micro.de/rect/assets/9764dbc1-5c80-4210-ab71-ccb414e855b0/SGM31323.pdf?access_token=JB0xlRQ-10F_vQg1XXqsnx8zy4iF65LO) and wanted to read back some registers to verify if the content is ok (not necessary, i'm ok but why not and of course if it's not working it's becoming interesting you know ...).

The described I2C protocol for reading a specific register (on page 7 of the datasheet) is different of what we expect in general. Instead of writing the register address and then use a RESTART on I2C bus the protocol should be:

I already test to use the classical endTransmission(addr, false). The result is as follow:

but neither respectfull to the datasheet nor working (0xFF instead of 0x00 i think)

I'm not seeing in the Wire library if there is a method of requesting to read a register value. I find requestFrom() method with 5 arguments but it's not working because it still use the "write register address then read" approch.

Do you think it's a limitation of the Wire library ? Is this kind of reading protocol I2C compliant ?

Thank You
Regards,
Damien

You obviously read register 0 and receive 0xFF from a Not AcKcepted (NAK) transfer.

If this is not what you expect then check again your assumptions. My bet: reg0 is not readable (write only).

This is how I read one byte from, for example, the MPU-6050:

  Wire.beginTransmission(MPU_addr);
  Wire.write(0x43);  // starting with register 0x43 (GYRO_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr, 1); // request a total of 1 byte
  byte result = Wire.read();

Useful guide to the Arduino Wire library:

More generally, to read N bytes, I use this function. Note that it does not check for N bytes received. See the discussion in the link above for an explanation.

// utility routines for Wire
// get N bytes of data, starting from address "reg"
void I2C_get(uint8_t I2Caddr, uint8_t reg, uint8_t * buf, uint8_t N) {
  Wire.beginTransmission(I2Caddr);
  Wire.write(reg);
  Wire.endTransmission(false);
  Wire.requestFrom(I2Caddr, N);
  while (Wire.available()) *buf++ = Wire.read();
}

Hello, thanks for your reply, this module is strange indead, in fact i found a thread on an exact clone with same issue. https://community.renesas.com/mcu/ra/f/forum/33217/i2c-send-memory-address-in-read-operation

Maybe is out of I2C protocol specification and generally speaking the fact is that everyone use this I2C slave like a write only one.

Hello, thanks for your reply. Yes this is the way i'm dealing with dozens of I2C slaves successfully. This one and also this one (same ?) https://www.kinet-ic.com/uploads/KTD2026-7-04h.pdf performs differently.

endTransmission only takes one argument