I have a PCB that I use to make some measurements on a proprietary silicon chip. We are including a number of test structures on the PCB to allow for some automated tests, for example relays that open/close some connections, analog multiplexers that allow the sensing of certain pins of the chip, and so on.
All the test structures are controlled via 'dumb' I2C IO expanders, you control them via I2C and can set the direction of each pin, input or output, and you can set the logic state, or read it.
On the board we have a microcontroller that serves as interface between the PC (USB) and the board itself (I2C).
At POR all the expanders pin are configured as inputs, so each time that you want to use the board you need to connect it to a PC, run a small piece of code to preset it correctly, and then use it.
This is of course acceptable if you need to run automated tests, but is not so convenient if you just want to power it and use it quickly, or if you need to send it to a customer that wants to evaluate the silicon, because distributing all the software is not an option at this time.
There are various approaches to solve the issue.
Jumpers We have a number of them, but it becomes cumbersome quickly, we are talking of more than 100 IOs. Moreover, if you want to be able to bypass a relay entirely, i.e. forced open and forced closed, you need two jumpers.
pull up/down This is a bit more attractive, but it kinda defeats the purpose: I want a software reconfigurable hardware, I don't want to rework tens of boards if I find a bug.
The ideal solution I am dreaming of a very simple chip, like an I2C EEPROM or something like that, where you write a sort of boot sequence:
And so on. The data above represents couples of address, data. This fantastic chip should have a gpio input to which I can connect a button: when I press the button, the EEPROM should act as an I2C master and send the data on the I2C bus, so as an example the bytes above mean "Send 10101010 to 0xAE, then send 10111100 to 0xAE and finally send 00000000 to 0x18".
My question is:
- Is there a better way to initialize an I2C IO expander?
- Does the chip I envisioned exist, or should I just suck it up and use a microcontroller?