0
\$\begingroup\$

I am using I2C port expanders namely TCA9554A and TCA6424A in my project. I have two options to read the inputs - (a) wait for interrupt and read (b) continuously keep polling the chip for any input changes.

Here is the sample arduino code to read a port:

Wire.beginTransmission(0x22); //0x22 is device's i2c address for TCA6424A
Wire.write(0x00); //Command to access port 0
Wire.endTransmission();
Wire.beginTransmission(0x22);
Wire.requestFrom(0x22, 1); //Requesting port state as 1 byte data
byte inputs=Wire.read();
Serial.println(inputs, BIN); //Printing the received state data

My concerns regarding polling way are the following:

1) Whether I2C lines are fine with handling traffic continuously for extended period of time. My project will be running for months (if not years). Only downtime will be when mains go off but that won't happen for more than an hour or so in a month's time period.

2) Since reading the state involves writing some data to some registers, will it wear off those registers causing an early failure of the port expander than it's expected lifetime.

Datasheets:

1) TCA9554A

2) TCA6424A

\$\endgroup\$
1
  • 3
    \$\begingroup\$ Don't worry, poll it every time you need. Significant wear occurs with EEPROM or flash. This one is neither. \$\endgroup\$
    – user76844
    Commented Mar 6, 2017 at 7:00

1 Answer 1

6
\$\begingroup\$

1) Whether I2C lines are fine with handling traffic continuously for extended period of time. My project will be running for months (if not years). Only downtime will be when mains go off but that won't happen for more than an hour or so in a month's time period.

no, that's not how conduction works. The I²C lines don't really care whether you use them or not.

2) Since reading the state involves writing some data to some registers, will it wear off those registers causing an early failure of the port expander than it's expected lifetime.

These registers are very likely simply some kind of RAM, so you can rest assured this isn't critical. Think about it this way: Every instruction your CPU executes involves at least one register modification. You do a couple billions of these per second.

Semiconductors in general are relatively indifferent to frequent usage, unless they get too hot through that.

One exception is EEPROM (and in that class, specifically flash memory), which actually physically degrades through overly often writing/erasing cycles (read cycles aren't that critical). According to the block diagram, there's none of that in your chips..


A general advice: Such ICs are sold in the tens of thousands to commercial/industrial customers. If you're buying a "name brand" component, and it has some limitation on how many times it can be used, the datasheet will prominently mention that. Simply because the manufacturer can't afford its devices to die in the field unexpectedly, leaving the customer (who bought a couple thousand) grumpy.

Your application doesn't seem overly harsh.


If I had to give you application development advice: if your IO expander isn't far away (which would warrant using I²C), you might be much easier and cheaper, and faster, when using a simply 74HC*** parallel-to-serial shift register, attached via SPI instead of I²C.

\$\endgroup\$
5
  • \$\begingroup\$ Thanks a lot Marcus for clearing all my doubts. I was aware of 74 series when i started the project but the size and pin constraints forced me to use an i2c based gpio expander and bite the bullet on cost side. \$\endgroup\$ Commented Mar 6, 2017 at 16:06
  • \$\begingroup\$ @Whiskeyjack are you sure? though they are most prominently known in their DIP enclosures, shift registers exist in many shapes&sizes: The HCF4021 for example is a 16 input parallel to serial shift register in a SO16 case, and you could basically daisy chain as many of those as you like if you need more than 16 inputs; takes one MCU Clock output, one MCU "latch" output, one MCU data input, so 3 pins in total. If you don't daisy-chain, just hardwire the latch, so it's 2 pins then. \$\endgroup\$ Commented Mar 6, 2017 at 16:17
  • \$\begingroup\$ Another, very cool thing is that you can find the cheapest ARM microcontroller you can and use them as a marionette through the two-wire SWD interface from your main MCU without writing firmware for them :) That's often really awesome, because it allows you, for example, to use the marionette's PWM units, counters, ADC and so on at a price much lower than common IO expanders/PWM controllers/ADCs. If you want, I can dig up a reference! \$\endgroup\$ Commented Mar 6, 2017 at 16:19
  • \$\begingroup\$ If you can point me to some references, it'd be really great. I am just a beginner. I have made PCBs for atmega328, esp8266, stm32 and capacitive sensing ICs. The marionette idea looks cool. I'd love to read more on that. And for my use case, I wanted an IC with both input and output and I wasn't able to find an ic with both features in 74 series. Are those types available? I have used 74hc595 IC in one of my projects. Requirement of both input and output in the latest project compelled me to use TCA series. \$\endgroup\$ Commented Mar 6, 2017 at 18:01
  • \$\begingroup\$ @Whiskeyjack go to alchemistowl.org/pocorgtfo , Read PoC||GTFO 0x10, part 10:5, "Cortex M0 Marionettes with SWD". \$\endgroup\$ Commented Mar 6, 2017 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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