Electronic – use a common Clock pin on the micro-controller project instead of separate clock pins

clock

In my Propeller project, I have the following devices, with the related pins:

  • DS1302 RTC
    • SClk – IO – CE
  • Micro SD Card
    • SClk – CD – CS – DI – DO
  • SPI SRAM x 2
    • SClk – SO – SI – CE
  • PS2 Mouse
    • Clock – Data
  • PS2 Keyboard
    • Clock – Data
  • Eprom
    • SCL – SDA

Right now, each one of these is individually allocated a Clock Pin,
What I would like to know is if I can merge all of the clock pins into 1 single pin
And re-use the other spare pin for extra devices?

Even if I need to introduce a transistor to boost the signal (So I am guessing, this is what may happen that there is not enough signal to service all the devices and I need a transistor? – I don't know I'm just guessing since I have no formal grounding in electronics)

For reference,
This is the link to an earlier post (different question) on stack electronics which shows my actual circuit/schematic

https://i.stack.imgur.com/pdCgo.png

Thank You

Best Answer

You could, for for some of these.

The DS1302 is not spi, but basically it is. The SD card is operating in SPI mode, and the SPI ram of course uses it. Since they each have a chip select pin, you can combine the clock lines. You could also combine the data lines if you wanted to, assuming you don't communicate to them (aka use multiple chip selects) at the same time. With an resistor between your SPI input and output, the DS1302 can be used on the same data lines as the 4 pin SPI devices.

You could also share the clock line between the i2c and the spi devices. I2C don't use chip selects, but as long as you don't send a start condition (SDA pulled low while SCL is high), then it should work.

The PS/2 devices though, normally need their own. Since the slave controls the clock and the master only pulls it low to initiate a read, sharing the clock line can cause interference or data corruption. One device may try to clock it at a different speed or slightly different period. You wouldn't be able to share it between each other let alone with the rest.

Given this, you can reduce 6 pins to 1, or 13 to 3