25.3.1 General TWI Bus Concepts

The TWI provides a simple, bidirectional, two-wire communication bus consisting of:
  • Serial Data Line (SDA) for packet transfer
  • Serial Clock Line (SCL) for the bus clock
The two lines are open-collector lines (wired-AND).

The TWI bus topology is a simple and efficient method of interconnecting multiple devices on a serial bus. A device connected to the bus can be a host or a client. Only host devices can control the bus and the bus communication.

A unique address is assigned to each client device connected to the bus, and the host will use it to control the client and initiate a transaction. Several hosts can be connected to the same bus. This is called a multi-host environment. An arbitration mechanism is provided for resolving bus ownership among hosts since only one host device may own the bus at any given time.

A host indicates the start of a transaction by issuing a Start condition (S) on the bus. The host provides the clock signal for the transaction. An address packet with a 7-bit client address (ADDRESS) and a direction bit, representing whether the host wishes to read or write data (R/W), are then sent.

The addressed I2C client will then acknowledge (ACK) the address, and data packet transactions can begin. Every 9-bit data packet consists of eight data bits followed by a 1-bit reply indicating whether the data was acknowledged or not by the receiver.

After all the data packets (DATA) are transferred, the host issues a Stop condition (P) on the bus to end the transaction.

Figure 25-2. Basic TWI Transaction Diagram Topology for a 7-Bit Address Bus