Basic SPI question

I’m new to the Arduino’s and micro programming so please be patient.

I want to tie several shields together and communicate between them using SPI. Here is where it gets a bit fuzzy for me. From what I think I understnad SPI uses a SS pin ( Shield select?? ) to notify each shield when it should be listenng to the serial pins. However in some cases, the SS pins are used by other shields as either their SS pin, or as a pin for some other component. For example, the wifi shield uses pin 4 as the SS for the SD card interface and the Color LCD shield uses ping 4 for a button.

I saw a reference in one post that seemed to indicate that you could change the SS in a library or your code so that it used a different pin. But I was thinking that the shield probably had a hardwired interface to that particular pin to “and” it in with the serial bits or something.

So after all of that my question is, how do I reconcile conflicts where the SS pins on different shields are involved?

Thanks

Chip

SS = Slave Select

Look at this tutorial: http://gammon.com.au/spi

Very good reading there. Might find what you are looking for.

Definitely check out the tutorial linked above. There’s a lot of great information in there on using SPI with Arduino, so it should definitely be beneficial for you.

To answer your question directly, you are correct that the SS line is generally hardwired on the shield itself. The typical work around for this if you had multiple shields attempting to use the same pin would be to cut the header pin on the top most shield, and short it to a different, opened pin. So for your example, you would probably have the Color shield stacked on top of the Wifly. You would cut the header pin 4 on the color shield, and then solder on a jumper wire to digital pin 2 on the shield, as this pin would be available. You would then simply need to change any code definitions to match up with the hardware changes you make.

It can get somewhat hairy with multiple shields, so it is something to keep in mind when designing your project. Often, you can get around this by using a combination of breakout boards and shields to keep everything straight.