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-Q1: How to set read and write commands

Part Number: TCA9539-Q1
Other Parts Discussed in Thread: TDA4VM

Tool/software:

Hi team,
     Currently, the TDA4VM is in use(mcu1_0) with the SDK version of TDA4VM_SDK_10.05.
     If the I2C address of my chip is 0x74

    1,When I want to set P00 to output high level, the command I need to send is
         Write command: 0x74, 0x06, 0xfe
         Write command: 0x74, 0x02, 0x01
    2,When I want to set P10 as an input, the command I need to send is
         Write command: 0x74, 0x07, 0x01
    3,When the INT changes, the command that needs to be sent is
         Write command: 0x74, 0x01
         Read command: 0x74, read data
    Is the format of the sending command I mentioned above correct?
BR
Fu Guojia
  • The address has seven bits and is 1110100. The first byte of an I²C transaction contains both the address and the R/W bit, so it must be 0xE9 or 0xE8. (I do not know how that library handles the address.)

    You should write the output port register before the configuration register so that the pin does not output the old value for a short time.

    When an interrupt happens, you should read both input port registers.

  • Hi team,
        Therefore, the correct way is

        1,When I want to set P00 to output high level, the command I need to send is
             Write command: 0xE8, 0x02, 0x01
             Write command: 0xE8, 0x06, 0xfe
        2,When I want to set P10 as an input, the command I need to send is
             Write command: 0xE8, 0x07, 0x01
        3,When the INT changes, the command that needs to be sent is
             Write command: 0xE8 0x01
             Read command: 0xE9, read PORT0,read PORT1
        Is the format of the sending command I mentioned above correct?
        By the way, When a change occurs at the input port, and the INT port changes from high (H) to low (L), will the INT port change from low (L) to high (H) after I finish reading the data?
        if I don't read the value of the input port using the interrupt method, can I use the polling method instead?
    BR
    Fu Guojia
  • Correct. (Each register write affect eight pins; I assume that the other seven bits are correct.)

    The interrupt output gets deactivated when all changed bits have been read.

    If the MCU does not have an available GPIO for the interrupt signal, then you can use polling instead.

  • The interrupt output gets deactivated when all changed bits have been read.

        When this happens, will the INT pin change from low (L) to high (H)? What I mean is that if I use the polling method, I only need to read the register data when the INT is low (L).

  • Yes; the inactive interrupt signal is high.

    When /INT is high, you know that none of the input pins have changed.