3
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Very close to what my suggestion was going to be. Though a timing circuit need not cost more than a fraction of a mA. If you do it with an ATTiny10 (easiest, one part, cheap option, say about $1 per 1) at low clock speed, you can get below 100uA. \$\endgroup\$ – Asmyldof Oct 13 '14 at 21:02
  • \$\begingroup\$ So basically I need a second uC doing the work on the slave side, am I correct? Power consumption is not really an issue here. \$\endgroup\$ – garph0 Oct 14 '14 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.