Skip to contentSkip to conversation

Two start conditions for PCA9554

DISCUSSION Hans J. Koch 2 participants 3 messages Apr 29, 2008 – May 1, 2008 1 message not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

I have an embedded board with a PCA9554 on it. It's an 8-bit IO expander similar to the PCF8574 in mainline. One difference is that when reading from the inputs, you have to do the following:

- start condition
- send slave address, R/W=0
- send command (0x00 = read input register)
- issue another start condition (!)
- send slave address, R/W=1
- read data
- stop condition

Can such a protocol be handled by the i2c subsystem?

Thanks,
Hans

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#1 lore raw
Quoted 12 lines · Hans J. Koch

I have an embedded board with a PCA9554 on it. It's an 8-bit IO expander similar to the PCF8574 in mainline. One difference is that when reading from the inputs, you have to do the following:

- start condition
- send slave address, R/W=0
- send command (0x00 = read input register)
- issue another start condition (!)
- send slave address, R/W=1
- read data
- stop condition

Quoted 1 line

Can such a protocol be handled by the i2c subsystem?

Yes. That is a normal repeated start transaction, and AFAIK exactly what all the other PCA, and virtually every other i2c chip for that matter, use. The smbus read byte data function will do this for you.

If you want multiple stops in a single transaction, the i2c subsystem can't do it, but I wrote a simple patch that allows it.

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.58.0804301422140.9894-13q4cmjDBaTP3RPoUHIrnuTW4wlIGRCZ@public.gmane.org

#3 lore raw
Quoted 13 lines · Trent Piepho
Quoted 12 lines · Hans J. Koch

I have an embedded board with a PCA9554 on it. It's an 8-bit IO expander similar to the PCF8574 in mainline. One difference is that when reading from the inputs, you have to do the following:

- start condition
- send slave address, R/W=0
- send command (0x00 = read input register)
- issue another start condition (!)
- send slave address, R/W=1
- read data
- stop condition

Quoted 5 lines
Quoted 1 line

Can such a protocol be handled by the i2c subsystem?

Yes. That is a normal repeated start transaction, and AFAIK exactly what all the other PCA, and virtually every other i2c chip for that matter, use. The smbus read byte data function will do this for you.

OK, thanks. I admit, I would be strange if the i2c subsystem didn't support that.

Quoted 3 lines

If you want multiple stops in a single transaction, the i2c subsystem can't do it, but I wrote a simple patch that allows it.

No need for that now, but I'll remember that...

Thanks,
Hans

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c