1
\$\begingroup\$

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.sstatic.net/pdCgo.png

Thank You

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

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

\$\endgroup\$
4
  • \$\begingroup\$ Keep the SD clock separate. There is a sort of protocol reset if you give it lots of clocks with no chip select. \$\endgroup\$
    – Oldfart
    Commented Apr 5, 2018 at 7:03
  • \$\begingroup\$ Thank You Both PasserBy & OldFart - That kind of answers everything in a nutshell & explained very nicely for Noobs like myself. I would like to mark this resolution as the answer but have a couple of questions related to your resolution. I would like to use Pin1 as the source for the Clock signal & share the RTC clock signal with the 2 SRAM IC's, additionally by freeing up 2 pins it allows me to add another 1MB SRAM IC. So I plan for 1 SRAM IC to be the VGA canvas RAM, & the other one plus 1 new one to be available for the System and the EndUser both sharing a common data bus \$\endgroup\$
    – Zeddy
    Commented Apr 5, 2018 at 9:47
  • \$\begingroup\$ (Continuing from ym comment above) I lack the (electronics/programmming) knowledge to share the pin with the Eprom and taking on board what OldFart wrote about the SD Card. So that gives me 2 spare pins. The VGA SRAM will be continually being read and written to when the screen needs updating. Thats why I am giving that one 4 pin connections, and the System/End-User RAM shared data bus. Does that make sense? and is it acheviable? Thank You. \$\endgroup\$
    – Zeddy
    Commented Apr 5, 2018 at 9:47
  • \$\begingroup\$ Yes. You simply wire the pins together, and in your code, you define the spi channel to the same pin number. \$\endgroup\$
    – Passerby
    Commented Apr 5, 2018 at 19:10
1
\$\begingroup\$

You can share pins between buses, but exactly which pinss depends on details of the buses, eg for SPI and I2C

\$\endgroup\$
3
  • 1
    \$\begingroup\$ You need to expand on this as its basically a link only answer. \$\endgroup\$
    – Passerby
    Commented Apr 5, 2018 at 2:16
  • \$\begingroup\$ @Henry - Thank You very much! - that was a very good page (I saved it for reference sake) Also I don't mind the link seems to make more sense than copy pasting all that stuff again \$\endgroup\$
    – Zeddy
    Commented Apr 5, 2018 at 9:25
  • 1
    \$\begingroup\$ The reason we don't like link only is because of link rot. If that link dies or changes, then the answer is lost. A good link answer here normally applies has at minimum a summary and a quote of the relevant parts. \$\endgroup\$
    – Passerby
    Commented Apr 5, 2018 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.