I am running a TCA9535 from a Pyboard (see micropython.org). I can talk to the 9535, all the levels look good on a scope (running at 3.3V). I monitor the I2C with a Jupiter Instruments I2C monitor, and see transactions in the order I expect. Here is the odd thing- when I change a bit on output port 0, and do it again, other registers in the 9535 appear to have changed. The log below shows the situation. First pass through, bit 0 is set, and then the registers are read back; second pass through bit 0 is cleared and then the registers are read back. Nothing in between. As can be seen, the registers read out differently on the second pass.
Micropython's I2C module seems to do reads by first doing a write with a register address, then a repeated start, and then a read. Unless the 9535 doesn't like repeated starts for some reason? This was at 100kHz, I tried it at 20kHz, and the results were the same. So everything is clean, repeatable, but wrong!
First pass through
Msg 001 <Start>[Add:40(W)]<ACK>[#02]<ACK>[#01]<ACK><Stop> t=287us <Set bit 0
Msg 002 <Start>[Add:40(W)]<ACK>[#06]<ACK> t=196us
Msg 003 <Start>[Add:41(R)]<ACK>[#F0]<NACK><Stop> t=196us <Correct
Msg 004 <Start>[Add:40(W)]<ACK>[#07]<ACK> t=196us
Msg 005 <Start>[Add:41(R)]<ACK>[#00]<NACK><Stop> t=196us <Correct
Msg 006 <Start>[Add:40(W)]<ACK>[#00]<ACK> t=196us
Msg 007 <Start>[Add:41(R)]<ACK>[#F1]<NACK><Stop> t=196us <Correct
Msg 008 <Start>[Add:40(W)]<ACK>[#01]<ACK> t=196us
Msg 009 <Start>[Add:41(R)]<ACK>[#FF]<NACK><Stop> t=196us <Correct
Msg 010 <Start>[Add:40(W)]<ACK>[#02]<ACK> t=196us
Msg 011 <Start>[Add:41(R)]<ACK>[#01]<NACK><Stop> t=197us
Msg 012 <Start>[Add:40(W)]<ACK>[#03]<ACK> t=196us
Msg 013 <Start>[Add:41(R)]<ACK>[#FF]<NACK><Stop> t=197us
Second pass through
Msg 014 <Start>[Add:40(W)]<ACK>[#02]<ACK>[#00]<ACK><Stop> t=287us <Clear bit 0
Msg 015 <Start>[Add:40(W)]<ACK>[#06]<ACK> t=196us
Msg 016 <Start>[Add:41(R)]<ACK>[#FF]<NACK><Stop> t=197us <Changed
Msg 017 <Start>[Add:40(W)]<ACK>[#07]<ACK> t=200us
Msg 018 <Start>[Add:41(R)]<ACK>[#FF]<NACK><Stop> t=196us <Changed
Msg 019 <Start>[Add:40(W)]<ACK>[#00]<ACK> t=196us
Msg 020 <Start>[Add:41(R)]<ACK>[#F0]<NACK><Stop> t=197us <Changed
Msg 021 <Start>[Add:40(W)]<ACK>[#01]<ACK> t=196us
Msg 022 <Start>[Add:41(R)]<ACK>[#00]<NACK><Stop> t=196us <Changed
Msg 023 <Start>[Add:40(W)]<ACK>[#02]<ACK> t=196us
Msg 024 <Start>[Add:41(R)]<ACK>[#00]<NACK><Stop> t=197us
Msg 025 <Start>[Add:40(W)]<ACK>[#03]<ACK> t=196us
Msg 026 <Start>[Add:41(R)]<ACK>[#FF]<NACK><Stop> t=197us