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.

I2C port expander PCA9539 problem

Other Parts Discussed in Thread: PCA9538, PCA9539

Hi!

I have a problem with these port expanders.

I set up a system where I have 4 PCA9538 chips on the same I2C bus,

each having their own addresses and all pins are configured as outputs.

Two PCA's are used to drive the bases of NPN transistors for relays.

The other two are used to drive LED's on a separate indicator panel that

is used to indicate which relays are turned on.

Program first configures all pins of all chips to outputs, writes 0x00 to  all

configuration registers and 0x00 to all polarity registers.

The input registers of the PCA9539's driving the relays are read back and

used by the indicators. Now the problem that I'm having is that most of the time

the pins of the PCA9539 driving the relays wont change and stay at 0.

  The I2C signal shows that the the data is written to the output registers and

the same data is also read back from the input registers but the pins themself

wont change. The indicator panel works correctly and the outputs reflect the state

that the relay driver should be.

Sometimes they work if I just write the output registers to 0xFF but not always,

if I create a loop where all outputs are toggled 1/0 with a period of 1s and if

it works right after reset then it dies after few periods.

I2C interface is configured to be 100kHz and the VCC is 3.3V.

The current drawn from single pin is less than 5ma and the NPN transistors

are capable to operate the relays with the provided base current.

What can cause this?

With best regards,

Marek

  • Small update.

    I managed to get this setup working by re-writing config registers every time I operate the chip.

    This approach is still analogous to a dental procedure performed through another part of the body

    that shall be unnamed here, but it hints that the config registers get corrupted either through incorrect

    I2C operation or through glitches in VCC that might cause the device to reset. I have not yet found any

    VCC glitches but I keep looking.

    With best regards,

    Marek