Reading PCA9555 configuration registers -- solved

Can the configuration registers be read (registers 6 & 7)? The datasheet is clear about the issues when reading the output registers, but is silent on this question.

If a bit is set to output and the device resets due to a glitch, reading the bit status (input or output) would reveal immediately if a reset had occurred (defaults to input).

Where is the link to that datasheet?

Just Google PCA9555 and pick the first NXP pdf

http://www.nxp.com/documents/data_sheet/PCA9555.pdf

On page 8, para. 6.2.5 it talks about writing to the configuration registers, but nothing about reading them.

Dr. Q

I added a routine to Keith Neufeld’s i2c_gpio code as follows:

// the gpio_check routine reads the configuration registers to see if outputs
// have been changed to inputs, indicating a power-on reset has occurred

int gpio_check(int address) {
  int data = 0;
  Wire.beginTransmission(address);  //  Send input register address
  Wire.write(REGISTER_CONFIG);
  Wire.endTransmission();
  Wire.beginTransmission(address); //  Connect to device and request two bytes
  Wire.requestFrom(address, 2);
  if (Wire.available()) {
    data = Wire.read(); }
  if (Wire.available()) {
    data |= Wire.read() << 8; }
  Wire.endTransmission();
  return data; } // end of gpio_check

then used it to check the registers with a suitably mixed control byte (0x0135)

// check the configuration registers
  gpio_dir(_relay, 0x0135) ;     // write a "checkable" pattern
  if(gpio_check(_relay) == 0x0135) {
    blinker(150) ;            // three quick blinks show gpio config
    blinker(150) ;            // read works
    blinker(150) ; }
    else {
      blinker(500) ;            // two long means not read
      blinker(500) ; }
  // end of check

and I got the 3 blinks, so I’m assuming the control registers are readable.

I'm glad you already found the solution.

Just Google PCA9555 and pick the first NXP pdf

No, it's not our task to google stuff for you. You have to provide the information to enable us to help you.