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.

TCA9535: i2c GPIO expander device not detected - linux host

Part Number: TCA9535
Other Parts Discussed in Thread: PCA9535

Please find below further information provided to the case:

Hello,
Using both the TCA9535 and PCA9535 as described in application notes within the datasheet, the device is not being recognized on the i2c bus. I am using linux as my host controller. I have verified with oscilloscope that the lines have activity. I have also verified that other non-TCA9535 i2c devices function when placed on the line. Do you have any recommendations on how to troubleshoot this? I have 10k pull up resistors on SDA/SCL. I have A0 A1 A2 all tied to ground (0x20 address). pin 12 to ground 24 to VCC 3.3V

I have tried using "i2cdetect -y 2 0x20". I have also written a C application using the i2c_smbus_*** interface that is part of the i2c-tools/i2c/libi2c-dev.h linux libraries that is failing to read/write bytes to the device. I have also tried "i2cget 2 0x20 0x00" and "i2cset 2 0x20 0x00".

Any advice on how to proceed debugging this issue?

  • Hi Greg,

    Our TCA devices requires a write transactions to set the pointer in the device before it will respond to an I2C read (such as an I2Cdetect as these are usually read transactions). 

    You will need to write to the TCA9535 to set the register/pointer you want to read from before it will ACK to any kind of read transaction (like I2Cdetect).

    -Bobby

  • I have attempted to write to the device, both in a C application using linux file read() and write() functions as well as the i2c_smbus_write_data_byte() functions, but the writes fail. C errno reports "no such device or address".

    When I attempt to use linux command line to issue "i2cset -y 2 0x20 0x00 0x00" I get a "write failed" from the device. I have verified other devices work on the same line. I have also tried multiple different modules. If this were to succeed I would then attempt a i2cget -y 0x20 0x00 as I assume I just commanded it to load register 0x00 for all successive reads.


    Another detail: I do not know what register "i2cdetect" would attempt to read from the device, and the datasheet only documents registers 0x00 through 0x07 which are for input,output,configuration, and polarity. Because of this, I do not know what register to "i2cset" before issuing "i2cdetect". Regardless, writing to any of the 0x00-0x07 registers also fails.


    Is it possible I need device tree settings changed for linux to work with this device? For reference I am running kernel 5.15.15 and Ubuntu 20.04

    I am running 400khZ i2C


    Thanks,

    Gary

  • Gary,

    Are you able to post a schematic of the TCA device that is failing to communicate and scopeshots of when you try to write to it?

    -Bobby

  • Thanks for your reply Bobby,

    From the scope if Im not mistaken I see the master sending the start condition followed by the address, but I get no response from the device. I am suspicious that the device is not functioning properly but Ive tried several different chips and Ive verified the breakout board theyre on has no shorts, and connectivity is good so Im stumped on what could be going on and if it could have something to do with linux. Ive tried 100k and 400k frequency.




    Note the next two are from result of "i2cset -y 2 0x20 0x00 0x00"
    blue is clock yellow is sda.
    note frequency should be set to 100khZ




  • As an additional note I have noticed this activity on the interrupt pin when issueing write commands to 0x00, i dont know if this is normal, i have added a pull up resistor to the int line:

    note 50us per division, clocks hould be 100kHz







    FYI I soldered a new chip on, and this transient lowering during write no longer appears to be occuring, not sure what this was.

  • Hey Greg,

    Thanks for the additional information.

    I took a look at the schematic, everything seems to look good. You're pinout matches the datasheet, the SDA/SCL nets match the SDA/SCL pinout, pull up resistors are present and look fine according to the scope shots. The I2C write transaction also looks valid to me, you sent the start condition followed by the address 0x20h and a write but you receive a NACK on the 9th bit. 

    To me, it looks like you've done everything correctly. 

    Could you tell me what the top marking code on the very top of the device says? 

    Can you also verify the Vcc pin is receiving power using the scope probe? 

    Is there anything between the SDA/SCL pins of the TCA device and the I2C controller? (like maybe a level shifter?) 

    -Bobby