Analogue daughter board ID
I have a main board with a P2 on which I can plug a daughter board with several analogue and digital IO functions on it. I plan to make diffenet versions of the daughter board in the future. They will be pin-for-pin compatible but have different characteristics such as different output power and gain or sensitivity. The daughter board has no memory and there are no spare pins left over. I'd like to be able to distinguish at least 4 different versions.
Of course, I can store the version of the daughter board somewhere in a file or protected flash memory region of the main board so that it can still look up the daughter board version even after a software update. However, I know Murphy's Law and I'm almost sure that somebody will mess things up by plugging the wrong daugther board in. This won't damage the board itself because it's self protecting but it may burn other devices connected to it because, for example, gain and current limit parameters are not set correctly.
I think, this is a perfect application of the smart pins of the P2. At the moment I have two ideas:
1. I can add a small capacitor to a non-time-critical input of the daughter board. For example, there is an enable/reset input. 1 means enable and 0 means reset. It has a pull-down resistor so it defaults to reset. If I add a 1nF capacitor to ground I can enable it and then let the pin float and measure the RC decay time it takes to fall back to the reset state. Alternate versions could use 0, 2.2 and 4.7nF.
2. I can add a voltage divider to an output of the daughter board. For example, there is a status pin, 0 means fault and 1 means OK. With a voltage divider I can reduce the voltage level of a logical "1" from 3.3 to say 3.0V. Of course, it still has to be well above the 1.65V threshold with some headroom for tolerances and noise, but 3.3V, 3.0V, 2.7V and 2.4V should be well distinguishable. I can use the DAC comperator mode and a two step aproximation. (ADC would require calibration and is too much trouble).
3. I could combine both options to distinguish even more differnt versions.
Any other ideas? Measuring the current draw of an external pull-up or pull-down resitor to determine its value is not that easy, I think. Is it possible to use the 1mA output and the DAC comperator input mode at the same time?