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: Unable to read anything but 1's?

Part Number: TCA9535

I am working with a TCA9535 IO Expander part connected to an 80C51 (Atmel AT89C51AC3) uC.

All of port 0 and pins 3 & 4 of port 1 are inputs (a rotary switch, 4 DIP switches and 2 push buttons).

I believe that I have configured port 1 with pins 0, 1, & 2 as outputs as I am able to drive those lines as desired.

Port 1 pins 5, 6, & 7 are unused and have been pulled to ground.

I can see that the inputs are changing at the pins on the part when I modify the switches/buttons. However, when I try to read anything I am getting all 1's.

I also get all 1's reading  the polarity inversion registers (which I have not modified, so expect them to be 0's by default) and the config register for port 1 (which I have modified to 0xF8 or even 0x18).

Although I am pretty confident in my I2C implementation on the uC, it is certainly possible I got something wrong. Watching the SCL/SDA lines with a logic analyzer everything looks good/makes sense.

We are running the everything at 5v and have 4.7k-ohm resistors pulling up SCL and SDA. Thinking the TCA9535 part could not pull the data line low, we put a 47k-ohm resistor on the data line but saw no difference. If that is the problem, it is probable that the part can not hold the clock low to stretch if needed, but we have not made that change.

Any thoughts on what I might be doing incorrectly or further experimentation would be greatly appreciated.

Thanks!
.Tim

  • Hello Tim,
    Can I get schematics to look at it and make sure there isn't anything I am missing and it can confirm that I understand what you said in the text. Do you also have an I2C tree to make sure we don't have address conflicts. You can also send waveforms of your signals too, but we should start with schematics.
    -Francis Houde
  • Francis -

    Thank you for responding. The TCA9535 is the only part on the I2C bus other than the uC. So, I am pretty confident there are no address conflicts...

        

    I am not using the Interrupt line. As I noted in my initial post, pins 18, 19, & 20 (port 1 pins 5, 6, & 7) have been connected to ground (technically to A0). I am currently waiting on rework where those pins will be connected to ground through 10k-Ohm resistors and suggested in the datasheet. Perhaps that will make a difference?

    I did realize that the TCA9535 is able to pull the data line low as it is ACK'ing my commands, so I presume that it could pull the clock line low if it needed to stretch the clock before writing the values out on the data line for my read requests.

    If you do want to look at the signals, what format would work best? I am using Saleae's Logic software. I can take a screenshot or I can export to one of the supported formats.

    Thanks again!
    .Tim

  • Francis -

    Thank you again for you willingness to help with my issue. With a little other help I was finally able to identify the error I was making in my logic. Had I posted the signal traces I collected, it probably would have been obvious to everyone even though I just could/would not see it.

    .Tim