Electronic – I2C combining read and write operation

communicationdatai2cprotocol

I'm designing my own data protocol for communication between PICs, ICs, etc. and in the specification I'd like to compare it to the existing I2C protocol.

There are two types of operation on the I2C bus:

  • Write operation: master writes START, address, data (the slave sends ACKs only)
  • Read operation: master writes START, address. Slave sends data, master sends ACK / NACK.

Just to get this clear for me: is there any way to use these operations, according to the protocol specification, to read and write data within one operation? You would win speed because you don't have to send the address twice. So is this possible?

Best Answer

There is no way to do what you want and still follow the I2C protocol. The closest you can get is the "Repeated Start" condition. Even with a repeated start, you must send the address a second time to read.

"Repeated start" is used in the case of a multi-master system, and it allows a master to lock the bus and prevent it from being taken over by another master. Instead of issuing a stop bit, the master sends another start bit, and retains control of the bus until the stop bit is sent. In this way, you could call the repeated start a single "operation", even though multiple reads/writes can be performed.

In your theoretical protocol, how much speed do you think you'll gain by not issuing the address a second time? Is that time savings needed for your design?