problem using Optiga Trust X I2C

Hi,

Did someone ever used the Infineon Optiga Trust X module with Arduino using I2C Wire library ?

Here is the technical documentation

I’m trying to get the I2C_STATE register data but I don’t receive anything after the Wire.requestFrom()

Thanks

Full code :

#include <Wire.h>

#define PIN_RST 8
#define PIN_VDD 9

void setup() {
  pinMode(PIN_RST, OUTPUT);
  pinMode(PIN_VDD, OUTPUT);
  digitalWrite(PIN_RST,LOW);
  digitalWrite(PIN_VDD,LOW);
  
  Serial.begin(115200);
  delay(2000);
  Wire.begin(); // join i2c bus (address optional for master)
  
  digitalWrite(PIN_VDD,HIGH);  // sartup the Trust X module
  digitalWrite(PIN_RST,HIGH);
  
  delay(15);  // startup min delay
}

long val = 9999;

void loop() {
  Wire.beginTransmission(48); // transmit to device #48 (0x30)
  Wire.write(byte(0x82));            // sends instruction byte
  Wire.endTransmission();     // stop transmitting

  Wire.requestFrom(48, 4);
  while(Wire.available()==0){

  }
  val = Wire.read(); // Reads the data from the register
  Serial.print("val = ");
  Serial.println(val);
  
  delay(5000);

}

What type of Arduino are you using?

How did you wire your setup? Please post a complete wiring diagram.

  Wire.requestFrom(48, 4);
  while(Wire.available()==0){

  }
  val = Wire.read(); // Reads the data from the register

Three problems with this block: You're requesting 4 bytes from the slave but you read only one. The while loop is not necessary and will end in an endless loop if the data couldn't be read from the device. And you don't check the return value of Wire.requestFrom() so you don't know if the request was successful.