I2C and AD7150

I've been tinkering with my pro mini and the AD7150 capacitive sensor as I need fF capacitance measurement.

I've used a PCA9306 level translator and a bus pirate to check my connections, all seems well. I've tried to read the chip ID of the AD7150 with both the bus pirate and the pro mini but it seems like the pro mini is displaying garbage. For instance, the default value for the configuration register (0x0f) is 0x19 (verified with bus pirate) shows 0x55 on my pro mini. The values for the chip ID does change randomly too :cold_sweat:

I have read nick's page on i2c and arduino but maybe I've missed something.

byte x[10];
byte sys_status, uart_recv;

void setup() {
  sys_status = init_sys();
  Serial.println(sys_status);
}

void loop(){
  if (Serial.available()) {
    uart_recv = Serial.read();
    switch(uart_recv) {
      case 'Q':
        Serial.println(sys_status);
        break;
      case 'R':
        sys_status = init_sys();
        Serial.println(x[0], HEX);
        Serial.println(sys_status);
        break;
    }
  }
}

byte init_sys(void) {
  byte error = 0;
  Serial.begin(115200);
  
  //I2C Initialization
  Wire.begin();
  TWBR = 12; //400kHz
  
  //Device Reset Sequence
  Wire.beginTransmission(0x48);    
  Wire.write(0xbf); //Reset AD7150
  error += Wire.endTransmission();
  delay(30);
  
  Wire.beginTransmission(0x48);
  Wire.write(0x0f);
  error += Wire.endTransmission();
  
  if(Wire.requestFrom(0x48,1) == 1) {
    x[0] = Wire.read();
  }
  return error;
}

The variable error always stays at 0, seems something is working.

Many thanks for your help!! :)

Fixed it had to use endTransmission(false) and then a requestFrom(..) :)