This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCA9539: IO-EXPANDER I2C Operation

Part Number: TCA9539


how write port data through i2c in tca9539

  • Hi Sai,

    You can see waveforms of different types of I2C transactions beginning on page 12 of the datasheet. To write output port data, you would need to both configure the ports as outputs using the configuration registers and configure their output states using the output registers. Here is a step-by-step procedure:

    1. Master sends START condition and addresses the IO expander. The address of TCA9539 is 11101 followed by the states of A1 and A0. The last bit of this I2C transaction should be a 0 to indicate a write. After this, the IO expander should acknowledge by pulling SDA low.

    2. Next, the master should write a command byte indicating which register to access. The listing of different command bytes is given in Table 3. Again, the IO expander should acknowledge.

    3. Then, the master can send the data that it wants to write to the chosen register. Note that the registers are in pairs, and data can be written to both halves of each pair without requiring the command byte to be re-sent. For example, the first byte transfer after a command byte of 0x02 would write to Output Port 0, and then the following byte transfer would be to Output Port 1. An illustration of this can be seen in Figure 31.

    4. Once the data transfer is complete, the master can terminate the transfer by sending a STOP condition. This will free the I2C bus for other devices to use or for future data transfers.

    I hope this is all clear, and please let me know if you have any questions.

    Regards,
    Max