I am using a P8X32A (Parallax "Propeller" microcontroller) in many of my hobby projects. It has no NV RAM internally on the chip so it loads its program code from either a serial port TX/RX pins or from an I2C EEPROM (24LC256) on SDA/SCL pins. This loading is entirely handled by the silicon on the micro and cannot be altered.
It takes no more than about 2 seconds or so for the code loading process to complete, after which time those four pins become fully general purpose IO in the 4 MSBs of a 32bit GPIO port! That's a pretty great feature, but it does mean I need to treat those 4 pins as a special case, which is not ideal.
- From the P8X32A Manual v1.2 (page 17). The jagged red line indicates the 4 signals I want to redirect after booting has completed.
For a future project I'm planning I would like to use all 32 pins of this GPIO port for high speed IO but I do not want to still have the top 4 pins connected to the serial port or the I2C bus.
My question:
What would be a robust, minimal part-count method for automatically severing the I2C and serial port lines from the microcontroller a fixed time after coming out of RESET state?
I can think of a few ways initially, but they have disadvantages...
Have an I2C controlled 4 pole 2 throw digital switch IC that shares a reset line with the microcontroller. At startup the 4 signals are connected by default to the I2C bus and serial and then the first thing that the program code does is to send an I2C command to that switch to toggle away from the I2C bus.
Use an externally generated signal (basically a dumb timer or a cheap secondary microcontroller that can respond to the reset pulse) to toggle a "normal" logic-level activated switch.
Put a second small microcontroller (e.g. ATTiny2313 or similar) in between the Propeller and the EEPROM, then simply have it count the number of bytes that passes through it and then shut down it's own IO completely until the reset pulse.
I don't like (1) because I'd need to implement the small bit of I2C in my program code, which is annoying but doable, but the main problem is finding a suitable I2C switch in a SOIC/SOP package.
I don't like (2) because it adds some potential for glitchiness or timing issues to creep in. Or if I go with a second microcontroller (ATTiny5 for instance) I'd have to have either a programming header on the board or have the chips pre-programmed off board. A hassle either way.
I don't like (3) because it's alot of work and adds a second set of fairly fiddly firmware to the project, which I'd rather avoid.
I suspect I'm over-thinking this, is there a better way to disengage an I2C bus completely after I've finished using it?
The "high speed IO" I want to have all 32 GPIO pins involved with will be 3v3 digital logic running anywhere between 1MHz and 40MHz.