Post Go back to editing

ADP5587 I2C Communication Issues

Hi,

I'm using the ADP5587ACPZ-R7 as a GPIO expander to control mainly LEDs.

I'm using the Arduino platform with their recommended code for I2C communication (from Wire.h class). However, I just can't get a communication working. The same code for writing to and reading from registers works fine with other chips like the ADXL345BCCZ on the same bus.

Is there anything special with the I2C communication of the ADP5587? I will attach code and schematics below. I'd really appreciate if someone could look over it and check if I'm missing anything.

Here is the code I'm using for writing to and reading from registers (using the Arduino Wire.h class):

void ADP5587_writeRegister(uint8_t reg, uint8_t val) {
  Wire.beginTransmission(0x68);
  Wire.write(reg); 
  Wire.write(val); 
  Wire.endTransmission();
}
uint8_t ADP5587_readRegister(uint8_t reg) {
  uint8_t resp;
  
  Wire.beginTransmission(0x68);
  Wire.write(reg); 
  Wire.endTransmission();
  
  uint8_t num_bytes = 1;
  Wire.requestFrom(0x68, num_bytes);

  while(Wire.available()) { 
    resp = Wire.read();
  }
  
  return resp;
}
Here is my schematics and PCB layout for the ADP5587:

Thanks a lot for the help.

Patrick

  • Hi Patrick,

    Your write sequence should work according to the Figure 17 of the datasheet. Can you confirm that the IC installed is ADP5587ACPZ-R7, and not  ADP5587ACPZ-1-R7?

    I have also edited some section for your read sequence. Please see below.

    uint8_t ADP5587_readRegister(uint8_t reg) {
      uint8_t resp;
      uint8_t num_bytes = 1;
      
      Wire.beginTransmission(0x68);
      Wire.write(reg); 
      Wire.endTransmission(false);
      
      Wire.requestFrom(0x69, num_bytes);
      while(Wire.available()) { 
        resp = Wire.read();
      }
      
      return resp;
    }

    The endTransmission() should have a boolean false parameter since you need to keep the I2C line active during the sequence. The address parameter of the requestFrom() should also be 0x69 since you are about to read from the device (Datasheet - page 14)

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.