7.5 Programming
The TUSB422 is controlled using I2C. The TUSB422 local I2C interface is available for reading/writing after TINT_N_LOW after the device is powered up. The SCL and SDA terminals are used for I2C clock and I2C data respectively.
Figure 5. TUSB422 I2C Addresses
7 (MSB) |
6 |
5 |
4 |
3 |
2 |
1 |
0 (W/R) |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0/1 |
The following procedure should be followed to write data to TUSB422 I2C registers (refer to Figure 6):
- The master initiates a write operation by generating a start condition (S), followed by the TUSB422 7-bit address and a zero-value “W/R” bit to indicate a write cycle.
- The TUSB422 acknowledges the address cycle.
- The master presents the sub-address (I2C register within TUSB422) to be written, consisting of one byte of data, MSB-first.
- The TUSB422 acknowledges the sub-address cycle.
- The master presents the first byte of data to be written to the I2C register.
- The TUSB422 acknowledges the byte transfer
- The master may continue presenting additional bytes of data to be written, with each byte transfer completing with an acknowledge from the TUSB422.
- The master terminates the write operation by generating a stop condition (P).
The following procedure should be followed to read the TUSB422 I2C registers without a repeated Start (refer Figure 7).
- The master initiates a read operation by generating a start condition (S), followed by the TUSB422 7-bit address and a zero-value “W/R” bit to indicate a read cycle.
- The TUSB422 acknowledges the 7-bit address cycle.
- Following the acknowledge the master continues sending clock.
- The TUSB422 transmit the contents of the memory registers MSB-first starting at register 00h or last read sub-address+1. If a write to the I2C register occurred prior to the read, then the TUSB422 shall start at the sub-address specified in the write.
- The TUSB422 waits for either an acknowledge (ACK) or a not-acknowledge (NACK) from the master after each byte transfer; the I2C master acknowledges reception of each data byte transfer.
- If an ACK is received, the TUSB422 transmits the next byte of data as long as master provides the clock. If a NAK is received, the TUSB422 stops providing data and waits for a stop condition (P).
- The master terminates the write operation by generating a stop condition (P).
The following procedure should be followed to read the TUSB422 I2C registers with a repeated Start (refer Figure 8).
- The master initiates a read operation by generating a start condition (S), followed by the TUSB422 7-bit address and a zero-value “W/R” bit to indicate a write cycle.
- The TUSB422 acknowledges the 7-bit address cycle.
- The master presents the sub-address (I2C register within TUSB422) to be written, consisting of one byte of data, MSB-first.
- The TUSB422 acknowledges the sub-address cycle.
- The master presents a repeated start condition (Sr).
- The master initiates a read operation by generating a start condition (S), followed by the TUSB422 7-bit address and a one-value “W/R” bit to indicate a read cycle.
- The TUSB422 acknowledges the 7-bit address cycle.
- The TUSB422 transmit the contents of the memory registers MSB-first starting at the sub-address.
- The TUSB422 shall wait for either an acknowledge (ACK) or a not-acknowledge (NACK) from the master after each byte transfer; the I2C master acknowledges reception of each data byte transfer.
- If an ACK is received, the TUSB422 transmits the next byte of data as long as master provides the clock. If a NAK is received, the TUSB422 stops providing data and waits for a stop condition (P).
- The master terminates the read operation by generating a stop condition (P).
The following procedure should be followed for setting a starting sub-address for I2C reads (refer to Figure 8).
- The master initiates a write operation by generating a start condition (S), followed by the TUSB422 7-bit address and a zero-value “W/R” bit to indicate a write cycle.
- The TUSB422 acknowledges the address cycle.
- The master presents the sub-address (I2C register within TUSB422) to be written, consisting of one byte of data, MSB-first.
- The TUSB422 acknowledges the sub-address cycle.
- The master terminates the write operation by generating a stop condition (P).
After initial power-up, if no sub-addressing is included for the read procedure (refer to Figure 8), then reads start at register offset 00h and continue byte by byte through the registers until the I2C master terminates the read operation. During a read operation, the TUSB422 auto-increments the I2C internal register address of the last byte transferred independent of whether or not an ACK was received from the I2C master.