Configure SPI on other digital pins?

I'm new to understanding serial communication and SPI and am working on a project that has multiple devices that connect through the SPI on an Arduino Mega. It uses a microSD card shield and a WiFly shield, and two LED displays, all of which use SPI. I've read enough to understand that, as long as my CS connection on each device has its own pin they can all share the MOSI, MISO, and SCLK pins without issue. The shields stack on top of one another so real estate for them is not an issue, but the two LED displays will have to plug into the SPI pins. So my question is this:

Can I programatically configure any other unused pins to also act as SPI pins (and if so, how), or do I have to splice the wires from the LED displays together? Or is there another way for the LED displays to share the SPI pin slots?

Thanks :slight_smile:

Yes, you can bit-bang other pins to look like SPI.
But if each device has their own CS pin, I don't know why you would have to.

You haven't explained the LED problem sufficiently, don't know what you are looking for there.

The LED display problem is that I have two displays to plug into the board and only one set of SPI pins. I figured if necessary I can probably splice the appropriate data and clock wires for the two displays together and plug them together into their respective pins; or, since I have lots of empty pins, I was hoping another option would be to plug one display into pins 50-52 (the designated SPI pins) and tell the board that pins 24-26 (for example) are also SPI and plug the second board into them.

Would there be any problems with the operation of the board if I have two sets of pins acting as SPI?

Thanks for your reply.

There is only 1 set SPI hardware. Connect the pins in parallel to all devices that need 5V signals, and go thru 74HC4050 for devices that need 3.3V levels on SCK, MOSI, and their CS. Connect all MISOs together.

Yeah, that's what I had figured would be the case. Just wanted to explore some ideas and investigate my options. Thanks for your help!

Hi guys,
I have an issue to command my CAN bus board with another SS pin. I chose the digitale pin 24 as output (for example) and the code is something like that:

-digitalWrite(24,LOW); -> to enable the bus for that shield
-send various messagges
-digitalWrite(24,HIGH); ->to disable the bus for that shield

This strategy does not work, there is someone that can help me please.


do you have pinMode (24, OUTPUT); in setup?

Yes, I tried also to put the SS pin to ground always but also in that case does not work

do you have any sketch that I can try?

Nope, I have not used CANBUS hardware.
Sparkfun or Adafruit carries a CANBUS shield, I think one site or the other has a demo sketch with it.