# Why are devices like the MCP23008 or PCF8574 still around when cheaper alternatives exist? [closed]

INB4: if this question doesn't fit this board, please delete. But I don't know where else to ask.

There're plenty of I/O port expanders available. Most of them add 8 I/O lines at the cost of two I2C lines (SDA, SCL). Here's the pinout for the MCP23008, taken as an example:

And here we have a pinout of ATtiny404 MCU:

The chip has 12 I/O lines, from which:

1. Two lines are for I2C, connected to hardware I2C module;
2. One line is reserved for RESET;
3. One line can be used to generate interrupts for external MCU;
4. 8 general purpose I/O lines.

So such MCU can easily substitute dedicated expander like MCP23008 or any of a kind. It will of course require some programming to do so. I self-rank my own programming skills somewhere between 'awful' and 'very poor', and still I think it will take me maybe 4-5 work days to write such firmware. Experienced programmer, I guess, can make it in 1-2 days. I see no obstacles here.

While for the Arduino guy (like me) simplicity is very important, in full scale production cost control comes to the first place. And what we have for the MCP23008? Here's offer from Digikey, roughly $8,000 per 10,000 pcs: https://www.digikey.com/product-detail/en/microchip-technology/MCP23008T-E-SO/MCP23008T-E-SOTR-ND/739286 And here's for ATtiny404, roughly$4,300 per 10,000 pcs: https://www.digikey.com/product-detail/en/microchip-technology/ATTINY404-SSNR/ATTINY404-SSNRTR-ND/8594960

That means that for 10,000 pcs price difference is about \$3,700. And 10k pcs isn't a breathtaking amount for a production device.

So the question is: what is the reason that such devices are not completely phased out by MCUs?

• If they are still selling the parts, they will continue to be made. There are lots of components with well over 30 years of history that are still being produced. Nov 20, 2018 at 15:23
• Why would I want to program a bunch of microcontrollers when I just need an I/O expander? What if I don't want a 16 MHz clock on my board when I just need a 100 kHz I2C bus? Nov 20, 2018 at 15:32
• Say you have a product that's been manufactured and sold for decades. The design works very reliably and technicians understand it well. Are you going to redo the entire design (potentially overcomplicating it), re-tool the assembly line, possibly having to get it re-certified, re-train technicians and risk the new design having unforeseen issues to save 37 cents a unit? Maybe, maybe not but there's more to it than just cost per unit of a single chip. Nov 20, 2018 at 15:35
• A design must be as complex as it needs to be to complete the task. An embedded controller can replace an I/O expander, but is that a legitimate use of an embedded controller. Nov 20, 2018 at 15:40
• @StainlessSteelRat this is very philosophical question. Is it a legitimate use of enormous computational power to play Red Dead Redemption 2? Is it a legitimate use of 6.0 12 mpg SUV to drive your precious self from home to work, alone? Is it a legitimate use of space satellite network to hunt for Pokemons? I don't know. Nov 20, 2018 at 16:27

## 5 Answers

One answer is industrial computers. If you lack IOs on the MPU you use such an expander.

In such computers, which usually run Linux, it's important that the drivers are in the mainline kernel. The cost of developing your own code for the ATtiny and the kernel driver for it and maintaining both is higher then those 3700 USD you mention in your question.

• "The cost of developing your own code for ... the kernel driver ..." - You could program the MCU to implement the exact same protocol the MCP23008 uses; no different driver needed. So I don't really see how that is an argument against the MCU... Nov 20, 2018 at 16:05
• @marcelm you still need to program that MCU Nov 20, 2018 at 16:19
• And ensure it works reliably Nov 20, 2018 at 16:20
• You raised two arguments in your answer: (1) programming the MCU, (2) programming a driver. My comment was arguing against (2). I agree with (1), and I never argued against it. Repeating that poin doesn't make my criticism of (2) invalid. Nov 20, 2018 at 16:22
• @JanDorniak I also don't understand. If you program MCU to work as a port expander, from the outside there's no difference between the two of them. You don't need any additional driver for the MPU. Yes, you need to program the MCU to perform functions of the expander. But as I see, this is not state-of-the-art programming. And you still n need to test stability, no matter what part you use in the system, MCU or expander. Nov 20, 2018 at 16:32

The main reason is cost.

You have forgot to take into account two very important factors:

1. The cost of writing the firmware for an MCU, and then maintaining it BUG free, throughout different silicon iterations. (yes, MCU with same part number but different silicon version, might need an updated FW)
2. The cost/time of programming/testing the additional MCU, and finding the space on the PCB for the programming pins.

When it comes to writing a driver for these expanders, you will have to do it even if you used an external MCU, so no gain there.

In essence, it is a lot easier, and cheaper to pay a little bit more for a product that is reliable and just drops into the system.

Little widely known fact, microchip dedicated ICs tend to be pre-programmed microchip general purpose PIC microcontrollers. Specifically ones like the mcp you use as an example.

The reason they are still used, is that they have tested code, warranted and supported by the manufacturer, which means no paying an engineer to remake the wheel and extensive testing and bug fixing, programming costs, etc. It just works. It's an cost-benefit analysis, for a convenience part. Just like most people can bake a loaf of bread easily and cheaply, but find it more convenient to buy one. Or routine car work. Or outsourcing a common IT task.

You are paying a premium for a turn key solution.

• What does "little widely known" mean? ;) Nov 20, 2018 at 17:14
• Open secret, uncommon sense, etc 😉 Nov 20, 2018 at 17:52

Functionally, the MCU you suggest isn't as versatile as the dedicated port expander as it lacks enough pins for the three address inputs - so you could only use one of them on your I2C bus. You could, of course, program the address into the chip as part of its program but that would mean multiple different versions of MCU code being needed.

But the main reason is that as well as developing, testing and maintaining the code you still have to physically program it into the MCUs themselves as part of your manufacturing process. That tends to be a manual operation that will cost way more in labour than the few pennies you save on the prices of components.

• Microchip offers programming service for a fee: microchipdirect.com/programming/…. For a small MCU programming of 10,000 pcs would cost less than 10 cents per chip. This makes suggested replacement less profitable, but still reasonable. But I got the idea. It seems that for less than a million of devices such replacement doesn't make much sense. Nov 20, 2018 at 17:13
• "... isn't as versatile as the dedicated port expander as it lacks enough pins for the three address inputs ..." - Well, the tiny204 has 12 gpios, 8 as output, 2 for I2C, that leaves 2 for address inputs if you want, so there is some flexibility there. Additionally, you could simply reprogram it with a different address, or allow setting the address with a special I2C command. I'm skeptical of the address thing as an argument... Nov 20, 2018 at 18:03
• How would you know which chip you're setting the address for unless it already had an address? Nov 20, 2018 at 18:33
• You'd program the MCU with a default address, then attach it to some circuit to configure a new address. You'd have to do it one extender at a time. Granted, there seems to be little advantage over simply reprogramming the MCU. Nov 20, 2018 at 19:18
• Well, that additional process is sure to wipe out any potential cost savings. Nov 20, 2018 at 21:45

some reason:

• using an ic over a standard port may help isolation. We have I2C isolator for this task.

• Todays, many microcontrollers work with 3.3volt, Using such IC help the designers interact with 5V

• A tiny microcontroller has many parts (Clock, General ALU, RAM, Flash controller, ...) But I2C IC is a dedicated IO chip, So the reliability of a simple dedicated module is higher than a general controller.

• many high-tech processor IO has many limitations, for example, 1.25volt output or input(because of other module installed on board) and they can't use processor IO for a common task.

• Usually these dedicated chip work over a higher temperature range(-40°C to +125°C)