I'm working in a project where I need to connect sensors with diferent interfaces, but I would like to use the same connector for all of them with the minimum number of pins possible. So what I thought of doing is to have the ADC, SPI, and I2C sharing some pins. To do that I think the only option that might work is using an analog MUX and then dynamically choose which of the outputs connect and also change the pin configuration from analog to digital and vice versa.
I haven't test it yet because I found a problem with the I2C component. The only master I2C component that creator gives you is one that uses SBC and you don't have the pins available to do what I want.
Anyone have any idea of how I could do what I want witout using more components?
I've attached an image of how I'm trying to do it.
Thanks in advance.
Routing for PSoC4 is not as universal as in PSoC3 or 5, some pins are dedicated to internal blocks as the I2C. Since all routing and configuration of pins is done by writing the right bit-pattern into the right register you can have that done theoretically by your program. The question is if a couple of jumpers on your pcb would do the same job for less money.
What does the physical interface look like for each different sensor ?
Maybe you could encode the plug for each specific sensor to indicate at connector
level what sensor is there. Or by forcing/reading current or voltage or signal and getting
a response PSOC can look at and translate what sensor is connected. Commonly used
in bed of nails testers to determine what DUT board is present.
Think of the problem of attaching a 3 pin transistor to 3 pins on PSOC, and by using
various forcing functions, V, I, signal, and/or measuring to determine if it is NPN, PNP,
Or put a R load in each sensor plug, its value indicating what sensor
is present,. and use PSOC to measure that load. 1 pin would be all it
takes, even 0 pins if you used reverse current < .3V measurement.
Food for thought.
Thank you both for your answers. I will read the TRM to see the registers involved because if is just a matter of changing registers it won't be a problem. I thought that maybe the ports routing could only be done at programming.
The jumpers are not a posible solution since the PCB have to be really small and no switches can be used.
I had already thought on how to detect each device, I just need to add a voltage divider to each sensor and then just read the voltage to determine which sensor it is.
Anyway, I'll take a look to the TRM and see if Ican figure out a good solution.