Electronic – Reset I2C slave chip when master goes away

i2creset

I have a board with a transformer and a MCP23017. This board is connected to another board via 4 wires which bring over power (+5V, GND) and I2C bus for an ATmega328P acting as the master.

The ATmega will enable some pins on the MCP23017 when the user selects an input. The I2C pull-up are on the ATmega side.

Once a pin is enabled the MCP23017 will keep it enabled until reprogrammed or reset.
I want to reset the MCP23017 if the cable is disconnected, in order to switch off the pins, but I don't know how to detect it, given the fact that unplugging the cable is severing the I2C connection (and removing power from the ATmega).

The only solution that comes to my mind is to use a second uC to ping the main ATmega and remove biasing on the MCP23017 if the main board is not answering anymore, but I'd love to find a simpler solution.

Best Answer

Since you say that the I2C-pullups are on the ATmega side maybe you could just run a timer and check if both SDA and SCL are low for longer than expected during normal communication and reset that timer once the signals go high. Maybe not the most power-efficient way but does not need any additional circuitry.